Description
Hello,
there is a lot of JavaScript tooling that uses AJV to validate OpenAPI specs. None of it seems to support 3.1, which is really unfortunate. I was trying to remedy the situation, but failed miserably.
As far as I can tell (see ajv-validator/ajv#1745) even the examples in your OpenAPI3.1 folder do not pass validation. The AJV folks (understandably) won't help unless I create a minimal reproducible example of a failing schema, which I'm not really qualified to do.
Would you be able to help/shed light on what's going on?
Copying the relevant details:
Ajv options object
{
allErrors: true,
validateFormats: false,
strictSchema: false,
strictTypes: false
}
See #2489 for a discussion on the options.
JSON Schema
The OpenAPI 3.1 schema defined here: https://github.com/OAI/OpenAPI-Specification/blob/main/schemas/v3.1/schema.json
Sample data
the OpenApi v3.1 webhook example here: https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.1/webhook-example.json
Your code
See: https://runkit.com/essential-randomness/612d87df07ae0a00092a3492.
This simply call ajv with the given options, passes the OpenApiv3.1 schema and tries to validate the OpenApi Webhook example.
Validation result, data AFTER validation, error messages
Error message:
Invalid:
data/webhooks/newPet/post/requestBody/content/application~1json/schema must NOT have unevaluated properties,
data/webhooks/newPet/post/requestBody must match "else" schema,
data/webhooks/newPet must match "else" schema,
data/components/schemas/Pet must NOT have unevaluated properties,
data/components/schemas/Pet must NOT have unevaluated properties
Thank you! Hopefully the errors are more understandable if you can read schemas :)