{"repo":"ahx/openapi_first","free":true,"listed":false,"github":"https://github.com/ahx/openapi_first","clone":"git clone https://github.com/ahx/openapi_first.git","description":"openapi_first is a Ruby gem for request / response validation and contract-testing against an OpenAPI API description. It makes APIFirst easy and reliable.","language":"Ruby","stars":219,"topics":["openapi","rest-api","api-server","web-framework","rack","ruby","jsonapi","openapi3","apifirst","design-first"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"openapi first openapi first is a Ruby gem for request / response validation and contract-testing against an OpenAPI 3.0 or 3.1 Openapi API description (OAD). It makes an APIFirst workflow easy and reliable. Usage Configure Use an OAD to validate incoming requests: Turn your request tests into contract tests against an OAD: Contents - Configuration - Rack Middlewares - Request validation - Response validation - Contract testing - Test assertions - Manual use - Framework integration - Hooks - Alternatives - Frequently Asked Questions - Development - Benchmarks - Contributing Configuration You should register OADs globally so you don't have to load the file multiple times or to refernce them by Symbol (like :v1 in this example). You can configure default options globally: or configure per instance: Rack Middlewares Request validation The request validation middleware returns a 4xx if the request is invalid or not defined in the API description. It adds a request object to the current Rack environment at env[OpenapiFirst::REQUEST] with the request parameters parsed exactly as described in your API description plus access to meta information from your API description. See Manual use for more details about that object. Error responses openapi first produces a useful machine readable error response that can be customized. The default response looks like this. See also RFC 9457. openapi first offers a JSON:API error response by passing error response: :jsonapi : See details of JSON:A","default_branch":null,"files":null,"tree":[],"storefront":"/r/ahx","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ahx/openapi_first/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}