APIDevTools / swagger-cli

Swagger 2.0 and OpenAPI 3.0 command-line tool
https://apitools.dev/swagger-cli
MIT License
515 stars 69 forks source link

invalid examples should not fail validation #68

Open scags9876 opened 2 years ago

scags9876 commented 2 years ago

We use our openapi 3.0.1 specs to automatically generate mocks and run contract tests. These contract tests include testing that the implementing server correctly validates requests and returns expected 400 Bad Request responses. This means we have examples in our docs of invalid requests. We cannot use swagger-cli validate, but would like to, because the validation fails on examples that don't adhere to the schema.

Ideal behavior would be to either be able to mark an example somehow to ignore validation for it, or pass an argument or configuration into swagger-cli validate to bypass validation of certain examples.

I will attempt to create a minimal schema to illustrate the issue.