Closed ClementMindflow closed 4 months ago
I assume you mean oneOf
, not onOff
.
I'm having the same issue. Getting: { "property": "instance", "message": "is not exactly one from \"TYPE A\",\"TYPE B"" } when the schema is defined as "oneOf": [...]
I came back here after a while... The issue did not came from the validation lib but from a misunderstanding about how oneOf were supposed to work. The spec say that the value should match one and exactly one schema in the list. And that care should be taken when crafting schemas inside a oneOf so they are not "structurally equivalent". Which is not the case here.
Closing this ticket.
Hello !
When validating a schema containing a
onOf
where two of the items are similar, an error is reported even if the value match the expected format.For example, validating the value
{ type: "json", value: "{\n \n}" }
against this schema:report the following error:
is not exactly one from <#/definitions/schema-A>,<#/definitions/schema-B>
See this codepen for a reproduction scenario.