Discriminator is not working with OneOf and AnyOf
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 (8)
-
-
- changed status to open
-
Submitted a PR for this issue: https://bitbucket.org/atlassian/swagger-request-validator/pull-requests/418
-
Any chance of merging the PR and having the fix shipped anytime soon?
-
Any process?
-
@James Navin could you please take a look at the PR? Would be really great if this issue could be resolved.
-
Available in
2.42.0
-
- changed status to resolved
- Log in to comment
PRs accepted :)