{"id":16860477,"url":"https://github.com/webpro/openapi-parser","last_synced_at":"2025-12-28T07:19:58.353Z","repository":{"id":66134203,"uuid":"476042068","full_name":"webpro/openapi-parser","owner":"webpro","description":"OpenAPI v3 parser","archived":false,"fork":false,"pushed_at":"2022-03-30T20:35:55.000Z","size":34,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-19T01:34:52.415Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webpro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-03-30T20:32:08.000Z","updated_at":"2024-01-21T03:15:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"dc9face5-3525-42db-b422-6ab4d94766ea","html_url":"https://github.com/webpro/openapi-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fopenapi-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fopenapi-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fopenapi-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fopenapi-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webpro","download_url":"https://codeload.github.com/webpro/openapi-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243307334,"owners_count":20270256,"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-10-13T14:24:27.031Z","updated_at":"2025-12-28T07:19:58.319Z","avatar_url":"https://github.com/webpro.png","language":"TypeScript","readme":"# openapi-parser\n\nThe OpenAPi v3 parser extracted from\n[openapi-typescript-codegen](https://github.com/ferdikoomen/openapi-typescript-codegen).\nSo first of all, all credits go to\n[Ferdi Koomen](https://github.com/ferdikoomen) for his work on this great\nlibrary. Only the parser is needed to render the models, services and hooks with\ncustom templates, hence this stripped down version.\n\n## Installation\n\n    npm install -D openapi-parser\n\n## API\n\n```typescript\nimport { readFile, writeFile } from 'fs/promises';\nimport { parse } from 'openapi-parser';\nimport { renderModel, renderService } from './templates';\n\nconst specs = JSON.parse(await readFile('swagger.json', 'utf8'));\n\nconst { version, server, models, services } = parse(specs);\n\nmodels.forEach(model =\u003e writeFile(`${model.name}.ts`, renderModel(model)));\nservices.forEach(service =\u003e\n  writeFile(`${service.name}.ts`, renderService(service))\n);\n```\n\n## Example render function\n\nThis could be anything from Handlebars templates to template literals. Here's a\nminimal example:\n\n```typescript\nimport { Operation, Service } from 'openapi-parser';\n\nconst renderOperation = (operation: Operation): string =\u003e {\n  const [result] = operation.results;\n  return `\n/**\n * ${operation.summary}\n * ${operation.description}\n * @returns ${result.type} ${result.description}\n ${operation.deprecated ? '* @deprecated' : ''}\n */\nexport function ${operation.name}([...]): Promise\u003c${result.type}\u003e {\n  return request({\n    method: '${operation.method}',\n    path: \\`${operation.path}\\`,\n    [...]\n  });\n}`;\n};\n\nexport default (service: Service) =\u003e {\n  return services.operations.map(renderOperation).join(';');\n};\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpro%2Fopenapi-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebpro%2Fopenapi-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpro%2Fopenapi-parser/lists"}