{"id":32408967,"url":"https://github.com/freb97/autodisco","last_synced_at":"2025-10-25T13:59:14.913Z","repository":{"id":318974013,"uuid":"1076950384","full_name":"freb97/autodisco","owner":"freb97","description":"🪩 Use legacy APIs with confidence","archived":false,"fork":false,"pushed_at":"2025-10-23T17:13:42.000Z","size":229,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-24T07:45:48.843Z","etag":null,"topics":["api","codegen","discovery","generation","openapi","rest","schema","typescript","zod"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/autodisco","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/freb97.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-15T15:07:06.000Z","updated_at":"2025-10-23T17:12:22.000Z","dependencies_parsed_at":"2025-10-17T14:01:12.992Z","dependency_job_id":"12181fd7-7993-4531-92cd-8f505f8f50dc","html_url":"https://github.com/freb97/autodisco","commit_stats":null,"previous_names":["freb97/autodisco"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/freb97/autodisco","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freb97%2Fautodisco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freb97%2Fautodisco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freb97%2Fautodisco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freb97%2Fautodisco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/freb97","download_url":"https://codeload.github.com/freb97/autodisco/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freb97%2Fautodisco/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280965037,"owners_count":26421548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","codegen","discovery","generation","openapi","rest","schema","typescript","zod"],"created_at":"2025-10-25T13:59:13.505Z","updated_at":"2025-10-25T13:59:14.904Z","avatar_url":"https://github.com/freb97.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AutoDisco\n\n[![Github Actions][github-actions-src]][github-actions-href]\n[![NPM version][npm-version-src]][npm-version-href]\n[![NPM last update][npm-last-update-src]][npm-last-update-href]\n[![License][license-src]][license-href]\n\n🪩 Use legacy APIs with confidence\n\nAutoDisco is a tool for automatic discovery of REST APIs that do not provide an OpenAPI specification themselves.\nIt generates an OpenAPI schema by inferring request and response structures from user-defined probes.\n\n## Installation\n\n```sh\nnpm install autodisco\n```\n\n## Usage\n\n```ts\nimport discover from 'autodisco'\n\nawait discover({\n  baseUrl: 'https://jsonplaceholder.typicode.com',\n\n  probes: {\n    get: {\n      '/todos': {},\n      '/posts': {},\n\n      '/posts/{id}': {\n        params: {\n          id: 1,\n        },\n      },\n\n      '/users/{id}': {\n        params: {\n          id: 1,\n        },\n      },\n\n      '/comments': {\n        query: {\n          postId: 1,\n        },\n      },\n    },\n\n    post: {\n      '/users': {\n        body: {\n          name: 'John Doe',\n          username: 'johndoe',\n          email: 'johndoe@example.com',\n        },\n      },\n    },\n  },\n})\n```\n\nThis will create an OpenAPI schema in `.autodisco/openapi/schema.json`.\n\n### Generating TypeScript Types\n\nIf you also want to generate TypeScript types for the probed endpoints, you can enable the `typescript` option in the `generate` configuration:\n\n```ts\nimport discover from 'autodisco'\n\nawait discover({\n  baseUrl: 'https://jsonplaceholder.typicode.com',\n\n  probes: {\n    get: { '/todos': {} },\n  },\n\n  generate: {\n    typescript: true,\n  },\n})\n```\n\nThis will create TypeScript types in the `.autodisco/typescript` directory in addition to the OpenAPI schema:\n\n```\n.autodisco/\n├── openapi/\n│   └── schema.json\n└── typescript/\n    └── types.d.ts\n```\n\n\u003e [!NOTE]\n\u003e Make sure to install `openapi-typescript` if you want to use TypeScript type generation:\n\u003e `npm install openapi-typescript`\n\n### Generating Zod Schemas\n\nIf you also want to generate Zod schemas for the probed endpoints, you can enable the `zod` option in the `generate` configuration:\n\n```ts\nimport discover from 'autodisco'\n\nawait discover({\n  baseUrl: 'https://jsonplaceholder.typicode.com',\n\n  probes: {\n    get: {\n      '/todos': {},\n    },\n\n    post: {\n      '/users': {\n        body: {\n          name: 'John Doe',\n          username: 'johndoe',\n          email: 'johndoe@example.com',\n        },\n      },\n    },\n  },\n\n  generate: {\n    zod: true,\n  },\n})\n```\n\nThis will create Zod schemas in the `.autodisco/zod` directory in addition to the OpenAPI schema:\n\n```\n.autodisco/\n├── openapi/\n│   └── schema.json\n└── zod/\n    ├── get/\n    │   └── Todos.ts\n    └── post/\n        └── Users.ts\n```\n\n\u003e [!NOTE]\n\u003e Make sure to install `quicktype-core` if you want to use Zod schema generation:\n\u003e `npm install quicktype-core`\n\n## Configuration\n\nThe `discover` function accepts a configuration object with the following values:\n\n- `baseUrl`: The base URL for the API (`string`, optional).\n- `outputDir`: The directory to output the generated files (`string`, default: `.autodisco`).\n- `probes`: An object containing endpoints to probe (`ProbeConfig`, required).\n- `headers`: An object containing headers to include in all requests (`Record\u003cstring, string\u003e, optional`).\n- `minify`: Whether to minify the generated OpenAPI schema (`boolean`, default: `false`).\n- `clear`: Whether to clear the output directory before generating files (`boolean`, default: `true`).\n- `logger`: Custom configuration for the logger ([Consola options](https://github.com/unjs/consola), optional).\n- `generate`: Options to customize code generation (optional)\n  - `zod`: Whether to generate Zod schemas (`boolean | generateZodOptions`, optional).\n  - `typescript`: Whether to generate TypeScript types (`boolean | generateTypescriptOptions`, optional).\n\n### Probe configuration\n\nEach probe can call an endpoint in multiple ways by specifying different combinations of `params`, `query`, and `body`.\nProbes supports the following options:\n\n- `params`: An object containing path parameters (optional).\n- `query`: An object containing query parameters (optional).\n- `body`: An object containing the request body (for POST, PUT, PATCH requests, optional).\n- `headers`: An object containing headers to include in the request (optional, overrides default headers).\n\n## Acknowledgements\n\nThis project is heavily inspired by and built with the following libraries:\n- [zod-openapi](https://github.com/samchungy/zod-openapi)\n- [openapi-typescript](https://github.com/openapi-ts/openapi-typescript)\n- [quicktype](https://github.com/glideapps/quicktype)\n\n## 📜 License\n\nPublished under the [MIT License](https://github.com/freb97/autodisco/tree/main/LICENSE).\n\n[github-actions-src]: https://github.com/freb97/autodisco/actions/workflows/test.yml/badge.svg\n[github-actions-href]: https://github.com/freb97/autodisco/actions\n\n[npm-version-src]: https://img.shields.io/npm/v/autodisco/latest.svg?style=flat\u0026colorA=18181B\u0026colorB=31C553\n[npm-version-href]: https://npmjs.com/package/autodisco\n\n[npm-last-update-src]: https://img.shields.io/npm/last-update/autodisco.svg?style=flat\u0026colorA=18181B\u0026colorB=31C553\n[npm-last-update-href]: https://npmjs.com/package/autodisco\n\n[license-src]: https://img.shields.io/github/license/freb97/autodisco.svg?style=flat\u0026colorA=18181B\u0026colorB=31C553\n[license-href]: https://github.com/freb97/autodisco/tree/main/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreb97%2Fautodisco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreb97%2Fautodisco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreb97%2Fautodisco/lists"}