I've spent some time documenting an API with Swagger/OAS 3. I want to validate our current API conforms with the OAS 3 document. How can I do this?
3 Answers
Your schema and examples defined in it could be used to generate and execute test cases with tools like Schemathesis.
It uses both examples and schemas and doesn't require configuration by default. It utilizes property-based testing to generate data and verifies properties defined in the tested schema - response codes, schemas, and headers. It also treats any 5xx responses as errors and will report it.
The simplest way to run it:
schemathesis run -c all http://my.server.com/openapi.json
This command will read the schema, generate tests, execute them against that server, run all built-in checks, and report all found problems.

- 418
- 3
- 17
You can run your OpenAPI Specifications as "Contract Tests" with Specmatic (video demo).
Please see documentation for more details.

- 456
- 3
- 14
You can use the swagger-cli
to validate your spec.
swagger-cli validate Test.yaml

- 37,428
- 8
- 84
- 134
-
I'm not looking to validate the spec, I'm looking to check the API response validates against the spec. I.e. is what the API sending back what we expect it to – Noodles Oct 01 '18 at 00:31