{"id":13602224,"url":"https://github.com/api-platform/api-doc-parser","last_synced_at":"2025-05-15T16:07:30.579Z","repository":{"id":19032204,"uuid":"85816363","full_name":"api-platform/api-doc-parser","owner":"api-platform","description":"Transforms a Hydra API doc in an intermediate representation that can be used for various tasks such as creating smart API clients, scaffolding code or building administration interfaces.","archived":false,"fork":false,"pushed_at":"2025-03-10T16:14:11.000Z","size":505,"stargazers_count":105,"open_issues_count":12,"forks_count":72,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-10T03:06:02.820Z","etag":null,"topics":["api","api-platform","hacktoberfest","hydra","javascript","json-ld","openapi","parser","rest","rest-api","scaffolding","swagger","typescript"],"latest_commit_sha":null,"homepage":"","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/api-platform.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},"funding":{"github":"api-platform","open_collective":"api-platform","tidelift":"packagist/api-platform/core"}},"created_at":"2017-03-22T10:46:38.000Z","updated_at":"2025-04-30T00:09:16.000Z","dependencies_parsed_at":"2024-01-14T04:35:24.994Z","dependency_job_id":"b47d75de-ce16-4384-b736-38e8f5a16cff","html_url":"https://github.com/api-platform/api-doc-parser","commit_stats":{"total_commits":213,"total_committers":37,"mean_commits":5.756756756756757,"dds":0.7370892018779343,"last_synced_commit":"3000d61c7fb48eacce67e9c533f318b92354b7e2"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/api-platform%2Fapi-doc-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/api-platform%2Fapi-doc-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/api-platform%2Fapi-doc-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/api-platform%2Fapi-doc-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/api-platform","download_url":"https://codeload.github.com/api-platform/api-doc-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253433661,"owners_count":21907774,"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":["api","api-platform","hacktoberfest","hydra","javascript","json-ld","openapi","parser","rest","rest-api","scaffolding","swagger","typescript"],"created_at":"2024-08-01T18:01:17.037Z","updated_at":"2025-05-15T16:07:30.535Z","avatar_url":"https://github.com/api-platform.png","language":"TypeScript","readme":"# API Doc Parser\n\n[![GitHub Actions](https://github.com/api-platform/api-doc-parser/workflows/CI/badge.svg?branch=main)](https://github.com/api-platform/api-doc-parser/actions?query=workflow%3ACI+branch%3Amain)\n[![npm version](https://badge.fury.io/js/%40api-platform%2Fapi-doc-parser.svg)](https://badge.fury.io/js/%40api-platform%2Fapi-doc-parser)\n\n`api-doc-parser` is a standalone TypeScript library to parse [Hydra](http://hydra-cg.com), [Swagger](https://swagger.io/specification/v2/), [OpenAPI](https://github.com/OAI/OpenAPI-Specification#the-openapi-specification) and [GraphQL](https://graphql.org/) documentations\nand transform them in an intermediate representation.\nThis data structure can then be used for various tasks such as creating smart API clients,\nscaffolding code or building administration interfaces.\n\nIt plays well with the [API Platform](https://api-platform.com) framework.\n\n## Install\n\nWith [Yarn](https://yarnpkg.com/):\n\n    yarn add @api-platform/api-doc-parser\n\nUsing [NPM](https://www.npmjs.com/):\n\n    npm install @api-platform/api-doc-parser\n\nIf you plan to use the library with Node, you also need a polyfill for the `fetch` function:\n\n    yarn add isomorphic-fetch\n\n## Usage\n\n**Hydra**\n```javascript\nimport { parseHydraDocumentation } from '@api-platform/api-doc-parser';\n\nparseHydraDocumentation('https://demo.api-platform.com').then(({api}) =\u003e console.log(api));\n```\n\n**OpenAPI v2 (formerly known as Swagger)**\n```javascript\nimport { parseSwaggerDocumentation } from '@api-platform/api-doc-parser';\n\nparseSwaggerDocumentation('https://demo.api-platform.com/docs.json').then(({api}) =\u003e console.log(api));\n```\n\n**OpenAPI v3**\n```javascript\nimport { parseOpenApi3Documentation } from '@api-platform/api-doc-parser';\n\nparseOpenApi3Documentation('https://demo.api-platform.com/docs.json?spec_version=3').then(({api}) =\u003e console.log(api));\n```\n\n**GraphQL**\n```javascript\nimport { parseGraphQl } from '@api-platform/api-doc-parser';\n\nparseGraphQl('https://demo.api-platform.com/graphql').then(({api}) =\u003e console.log(api));\n```\n\n## OpenAPI Support\n\nIn order to support OpenAPI, the library makes some assumptions about how the documentation relates to a corresponding ressource:\n- The path to get (`GET`) or edit (`PUT`) one resource looks like `/books/{id}` (regular expression used: `^[^{}]+/{[^{}]+}/?$`).\nNote that `books` may be a singular noun (`book`).\nIf there is no path like this, the library skips the resource.\n- The corresponding path schema is retrieved for `get` either in the [`response` / `200` / `content` / `application/json`] path section or in the `components` section of the documentation.\nIf retrieved from the `components` section, the component name needs to look like `Book` (singular noun).\nFor `put`, the schema is only retrieved in the [`requestBody` / `content` / `application/json`] path section.\nIf no schema is found, the resource is skipped.\n- If there are two schemas (one for `get` and one for `put`), resource fields are merged.\n- The library looks for a creation (`POST`) and list (`GET`) path. They need to look like `/books` (plural noun).\n- The deletion (`DELETE`) path needs to be inside the get / edit path.\n- In order to reference the resources between themselves (embeddeds or relations), the library guesses embeddeds or references from property names.\nFor instance if a book schema has a `reviews` property, the library tries to find a `Review` resource.\nIf there is, a relation or an embedded between `Book` and `Review` resources is made for the `reviews` field.\nThe property name can also be like `review_id`, `reviewId`, `review_ids` or `reviewIds` for references.\n- Parameters are only retrieved in the list path.\n\n## Support for other formats (JSON:API...)\n\nAPI Doc Parser is designed to parse any API documentation format and convert it in the same intermediate representation.\nIf you develop a parser for another format, please [open a Pull Request](https://github.com/api-platform/api-doc-parser/pulls)\nto include it in the library.\n\n## Run tests\n\n    yarn test\n    yarn lint\n\n## Credits\n\nCreated by [Kévin Dunglas](https://dunglas.fr). Sponsored by [Les-Tilleuls.coop](https://les-tilleuls.coop).\n","funding_links":["https://github.com/sponsors/api-platform","https://opencollective.com/api-platform","https://tidelift.com/funding/github/packagist/api-platform/core"],"categories":["TypeScript","api"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapi-platform%2Fapi-doc-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapi-platform%2Fapi-doc-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapi-platform%2Fapi-doc-parser/lists"}