{"id":15091225,"url":"https://github.com/braintree/open_api_parser","last_synced_at":"2025-10-06T10:31:09.529Z","repository":{"id":56886807,"uuid":"68948768","full_name":"braintree/open_api_parser","owner":"braintree","description":"A parser for Open API specifications","archived":true,"fork":false,"pushed_at":"2018-03-21T14:46:47.000Z","size":42,"stargazers_count":30,"open_issues_count":2,"forks_count":18,"subscribers_count":67,"default_branch":"master","last_synced_at":"2025-01-15T08:29:23.211Z","etag":null,"topics":["open-api","rack","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/braintree.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-22T18:11:27.000Z","updated_at":"2023-07-25T14:04:25.000Z","dependencies_parsed_at":"2022-08-20T13:50:59.497Z","dependency_job_id":null,"html_url":"https://github.com/braintree/open_api_parser","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/braintree%2Fopen_api_parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/braintree%2Fopen_api_parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/braintree%2Fopen_api_parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/braintree%2Fopen_api_parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/braintree","download_url":"https://codeload.github.com/braintree/open_api_parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235519935,"owners_count":19003201,"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":["open-api","rack","ruby"],"created_at":"2024-09-25T10:36:34.265Z","updated_at":"2025-10-06T10:31:04.210Z","avatar_url":"https://github.com/braintree.png","language":"Ruby","readme":"# OpenApiParser\n\n[![Build Status](https://travis-ci.org/braintree/open_api_parser.svg?branch=master)](https://travis-ci.org/braintree/open_api_parser)\n\nA gem for parsing [Open API](https://openapis.org/) specifications.\n\n## Usage\n\nFirst, resolve a specification given an absolute file path.\n\n```ruby\nspecification = OpenApiParser::Specification.resolve(\"/path/to/my/specification.yaml\")\n```\n\nWhen you `resolve` your file, all references will be expanded and inlined. The fully resolved specification will be validated against the Open API V2 meta schema. If you'd like to prevent meta schema validation, you can provide an option to do so.\n\n```ruby\nspecification = OpenApiParser::Specification.resolve(\"/path/to/my/specification.yaml\", validate_meta_schema: false)\n```\n\nIf you'd rather instantiate a specification with a _fully resolved_ ruby hash, you can do so by directly instantiating an `OpenApiParser::Specification::Root`.\n\n```\nOpenApiParser::Specification::Root.new({...})\n```\n\n### Reference resolution\n\n`OpenApiParser::Specification.resolve` will fully resolve the provided Open API specification by inlining all [JSON References](https://tools.ietf.org/id/draft-pbryan-zyp-json-ref-03.html). Two types of references are allowed:\n\n* [JSON Pointers](https://tools.ietf.org/html/rfc6901)\n* JSON References to files\n\nPointers are resolved from the root of the document in which they appear. File references are resolved relative to the file in which they appear. Here's an example of each:\n\n```yaml\ndefinitions:\n  person:\n    type: object\n    properties:\n      name:\n        type: string\n      age:\n        type: integer\n\ninfo:\n  person:\n    $ref: \"/definitions/person\"\n  other:\n    $ref: \"file:another/file.yaml\"\n```\n\nFor more information, see the specs.\n\n### Endpoints\n\nWith a resolved schema, you can access the information for an endpoint given a path and an HTTP verb.\n\n```ruby\nendpoint = specification.endpoint(\"/animals\", \"post\")\n```\n\nWith an endpoint, you can get access to JSON schema representations of the body, headers, path, query params and response body and headers defined in your Open API specification. You can use these to validate input using any existing JSON Schema library. We recommend [JsonSchema](https://github.com/brandur/json_schema).\n\n```ruby\nendpoint.body_schema\n# =\u003e {...}\n\nendpoint.header_schema\n# =\u003e {...}\n\nendpoint.path_schema\n# =\u003e {...}\n\nendpoint.query_schema\n# =\u003e {...}\n\nendpoint.response_body_schema(201)\n# =\u003e {...}\n\nendpoint.response_header_schema(201)\n# =\u003e {...}\n```\n\nYou can also use the endpoint to transform user input into json that can be validated against the schemas generated in the previous examples.\n\n```ruby\nendpoint.header_json(request_headers_as_hash)\n# =\u003e {...}\n\nendpoint.path_json(\"/animals/123?query=param\")\n# =\u003e {...}\n\nendpoint.query_json(request_query_params_as_hash)\n# =\u003e {...}\n```\n\nFor more information, see the specs.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'open_api_parser'\n```\n\nAnd then execute:\n\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n\n```bash\n$ gem install open_api_parser\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbraintree%2Fopen_api_parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbraintree%2Fopen_api_parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbraintree%2Fopen_api_parser/lists"}