Add support for the `discriminator` keyword
Issue #26
resolved
The discriminator
keyword is a Swagger/OpenAPI extension to the JSON Schema spec and so is not supported by the JSON schema validation library.
It would be good to add support for this keyword.
See https://github.com/OAI/OpenAPI-Specification/issues/333 for a discussion.
Comments (4)
-
reporter -
reporter - changed status to open
-
reporter Ive decided to implement support using a metaschema for the JSON Schema Validator, which will allow for addition of other Swagger-specific keywords in the future.
Basic checking of syntax and allowed values for the 'discriminator' field is working. Next step will be to coerce the schema validator to use the sub-schema in place of the parent when performing validation.
-
reporter - changed status to resolved
Available in v1.0.10
- Log in to comment
One option may be to transform the schema and replace
discriminator
withoneOf
- from the discussion in the above thread this may be enough to generate useful validation messages.