{"repo":"mkon/openapi_contracts","free":true,"listed":false,"github":"https://github.com/mkon/openapi_contracts","clone":"git clone https://github.com/mkon/openapi_contracts.git","description":"Openapi schemas as API contracts","language":"Ruby","stars":46,"topics":["openapi","redoc","rspec","swagger","json-schema","ruby"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"OpenapiContracts Use OpenAPI documentation as an API contract. Currently supports OpenAPI documentation in the structure as used by Redocly, but should also work for single file schemas. Adds RSpec matchers to easily verify that your requests and responses match the OpenAPI documentation. Usage First, parse your API documentation: In case the filename argument is not set, parser will by default search for the file named openapi.yaml . Ideally you do this once in an RSpec before(:suite) hook. Then you can use these matchers in your request specs: You can assert a specific http status to make sure the response is of the right status: Options The match openapi doc($doc) method allows passing options as a 2nd argument. path allows overriding the default request.path lookup in case it does not find the correct response definition in your schema. This is especially important when there are dynamic parameters in the path and the matcher fails to resolve the request path to an endpoint in the OAS file. request body can be set to true in case the validation of the request body against the OpenAPI requestBody schema is required. parameters can be set to true to validate request parameters against the parameter definitions Both options can as well be used simultaneously. Without RSpec You can also use the Validator directly: Coverage reporting You can generate a coverage report, giving an indication how many of your OpenApi operations and responses are verified. To enable the report, se","default_branch":null,"files":null,"tree":[],"storefront":"/r/mkon","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/mkon/openapi_contracts/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."}