Discriminator is not working with OneOf and AnyOf

Issue #771 open
Sravan Kumar Sandela created an issue

We were with assumption that Discriminator is fully supported based on swagger-request-validator specifications support list.

But it seems you have implemented Discriminator only for allOf, and not anyOf or OneOf. This is strange because as per OpenAPI Spec, Discriminator is used against oneOf and AnyOf only.

https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/

Following is the code that says the same.

final JsonNode currentSchemaNode = data.getSchema().getNode();
        if (currentSchemaNode.has("oneOf") || currentSchemaNode.has("anyOf")) {
            log.debug("Support for discriminators with oneOf/anyOf not implemented yet. Validation may be inaccurate.");
            return;
        }

Are you planning to implement this?

Comments (6)

  1. Michał Kaciuba

    @James Navin could you please take a look at the PR? Would be really great if this issue could be resolved.

  2. Log in to comment