skryukov / skooma

Skooma is a Ruby library for validating API implementations against OpenAPI documents.
MIT License
140 stars 5 forks source link

Add `discriminator` keyword support #2

Closed skryukov closed 11 months ago

skryukov commented 11 months ago

This PR adds initial discriminator keyword support.

According to a not-yet-released update to the specification (https://github.com/OAI/OpenAPI-Specification/pull/2618), the discriminator keyword is an annotation keyword, that SHOULD fail the validation when no schema can be determined.

We also use discriminator keyword annotation in anyOf and oneOf keywords to reorder the list of schemas, which might increase performance of validation later with introduction of short circuit errors.