{"id":23627250,"url":"https://github.com/thebumpaster/mongoose-to-openapi","last_synced_at":"2025-11-07T21:30:29.386Z","repository":{"id":247573729,"uuid":"826241786","full_name":"TheBumpaster/mongoose-to-openapi","owner":"TheBumpaster","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-11T08:15:35.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-27T23:57:44.266Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/TheBumpaster.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}},"created_at":"2024-07-09T10:31:33.000Z","updated_at":"2024-07-11T08:14:54.000Z","dependencies_parsed_at":"2024-07-09T13:45:10.933Z","dependency_job_id":null,"html_url":"https://github.com/TheBumpaster/mongoose-to-openapi","commit_stats":null,"previous_names":["thebumpaster/mongoose-to-openapi"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheBumpaster%2Fmongoose-to-openapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheBumpaster%2Fmongoose-to-openapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheBumpaster%2Fmongoose-to-openapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheBumpaster%2Fmongoose-to-openapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheBumpaster","download_url":"https://codeload.github.com/TheBumpaster/mongoose-to-openapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239539232,"owners_count":19655752,"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","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":[],"created_at":"2024-12-27T23:57:53.169Z","updated_at":"2025-11-07T21:30:29.339Z","avatar_url":"https://github.com/TheBumpaster.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mongoose-to-openapi\n\nA TypeScript library for generating OpenAPI Schema Component Definitions from Mongoose Schemas.\n\n## Installation\n\n```bash\nnpm install mongoose-to-openapi\n```\n\n## Usage\n\n### Initializing the OpenAPI Factory\n\n```typescript\nimport createOpenAPIFactory from 'mongoose-to-openapi';\n\nconst openAPIFactory = createOpenAPIFactory({\n\tinfo: {\n\t\ttitle: 'My API',\n\t\tversion: '1.0.0'\n\t},\n\tschemaPattern: './src/models/**/*.ts',\n});\n\nopenAPIFactory.init();\n```\n\n### Adding Routes\n\n#### Adding a Single Route\n\n```typescript\nopenAPIFactory.addRoute('/users', 'get', {\n\tsummary: 'Get all users',\n\tresponses: {\n\t\t'200': {\n\t\t\tdescription: 'A list of users',\n\t\t\tcontent: {\n\t\t\t\t'application/json': {\n\t\t\t\t\tschema: {\n\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\titems: { $ref: '#/components/schemas/User' }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n});\n```\n\n#### Adding Multiple Routes\n\n```typescript\nopenAPIFactory.addRoutes({\n\t'/users': {\n\t\tget: {\n\t\t\tsummary: 'Get all users',\n\t\t\tresponses: {\n\t\t\t\t'200': {\n\t\t\t\t\tdescription: 'A list of users',\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\t\t\titems: { $ref: '#/components/schemas/User' }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t'/users/{id}': {\n\t\tget: {\n\t\t\tsummary: 'Get a user by ID',\n\t\t\tparameters: [\n\t\t\t\t{\n\t\t\t\t\tname: 'id',\n\t\t\t\t\tin: 'path',\n\t\t\t\t\trequired: true,\n\t\t\t\t\tschema: {\n\t\t\t\t\t\ttype: 'string'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t],\n\t\t\tresponses: {\n\t\t\t\t'200': {\n\t\t\t\t\tdescription: 'A user object',\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tschema: { $ref: '#/components/schemas/User' }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n});\n```\n\n### Exporting the OpenAPI Object\n\n```typescript\nconst openAPI = openAPIFactory.getOpenAPI();\nconsole.log(JSON.stringify(openAPI, null, 2));\n```\n\n## Configuration Options\n\n- `info`: Information about the API (title, version, etc.).\n- `schemaPattern`: A glob pattern to locate Mongoose schema files.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebumpaster%2Fmongoose-to-openapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthebumpaster%2Fmongoose-to-openapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebumpaster%2Fmongoose-to-openapi/lists"}