Closed gigaga closed 1 year ago
Polymorphism isn't supported yet.
The OEV (openapi-examples-validator
) uses ajv for validation, under the hood. The discriminator
-option has been added with a "more recent" version of AJV (v8.6.1
).
OEV still uses v6.12.6
of AJV, because starting with version 7 the support for JSON Schema draft 4 has been dropped, which the OpenAPI-specification (prior to version 3.1.0
) relies on.
While there are ways to support draft-04
with a more recent version of AJV, more (potential breaking) changes will be necessary. This is why it hasn't been upgraded yet. Of course, it will be done eventually but I can't tell you yet when I'll get to do this.
Thx for these explanations. I'm going to try to implement it my self and I will make a PR if any.
Regards
Merged with #185 @gigaga thanks, for your contribution
Hi,
first, thank a lot for your magic tool. It is really great to be able to validate our examples!! However, I have a question about polymorphism. Indeed, can you tell me how validate examples with polymorphism based.
For example, with the following spec :
We have an endpoint to create several "Pet", so, we have an abstract schema "Pet" with others schema which inherits of Pet, like "Dog". So we are trying to provide "Dog" creation but, in this case, property
dogName
is invalid butopenapi-examples-validator
doesn't see that.Can you help me ?
Regards,