Closed Xbloud closed 1 year ago
Your issue may relate to support for only a strict subset of discriminator
.
This may not relate to your problem, but I wanted to note that OpenAPI 3.0.x does not match JSON Schema exactly and you must first convert it using e.g. openapi-schema-to-json-schema. You must also use the draft04 JSON Schema spec.
Sorry, I missed this issue.
Is there any option to disable the "discriminator" property checking/handling?
The problem is that the behavior of discriminator is underspecified, and outside the strict subset mentioned above, that behavior is non-obvious.
Disabling coherence checks on schema could lead to unexpected and/or unspecified behavior.
More specifically: in the schema given above, the behavior apparently expected from the allOf
usage contradicts the upstream JSON Schema spec. It should have been anyOf
or oneOf
.
As a rule of thumb, everything that passes with discriminator should also pass without it, which is something this schema does not follow.
Covering underspecified or contradictory cases of discriminator
is not planned.
Closing as answered, please feel free to comment if there are more questions.
I use the OpenAPI's discriminator property in my JSON schemas and I get the following error when compiling schemas: ERROR Error: [discriminator]: need propertyName, oneOf OR anyOf at ConfigBase# It seems that your discriminator property checking does not cover all valid options. Is there any option to disable the "discriminator" property checking/handling?
JSON schemas:
"Base" : { "type" : "object", "properties" : { "description" : { "type" : "string", }, "dp" : { "type" : "string", } }, "discriminator" : { "propertyName" : "dp" } },
"IndividualBase" : { "type" : "object", "allOf" : [ { "$ref" : "Base#" }, { "type" : "object", "properties" : { "key" : { "type" : "string", } } } ] },