Open anatoliy-balakirev opened 5 years ago
If someone is interested in what is actually the use case for that weird schema: we are getting it from the front end, where they want to have some polymorphic object, which they can render in some generic way. Original schema is much bigger, I've extracted only part, which is causing an issue. This schema is generated based on openapi spec, which we use as a contract between front end and back end. On our side we are basically validating generated responses against that schema.
Following json:
Is reported as invalid when validated against following schema:
Here is a validation output from http://json-schema-validator.herokuapp.com/ :
Why is it the case? Json seems to be valid... If I adjust schema to use
"additionalProperties": true
- then validation passes properly. Also in that case those fields are actually validated: when I change my json to have this, for example:"type": "string2"
(instead of"type": "string"
) - I get proper validation errors. I do not want to set thatadditionalProperties
flag totrue
in my real application. We have to reject additional properties there.