Given this schema to highlight the problem
$id: resource:/schema/issueXXX
$defs:
TypeA:
type: object
required:
- kind
properties:
kind:
type: string
TypeB:
type: object
required:
- kind
properties:
kind:
type: string
oneOf:
- $ref: "#/$defs/TypeA"
- $ref: "#/$defs/TypeB"
discriminator:
propertyName: kind
mapping:
A: "#/$defs/TypeA"
B: "#/$defs/TypeB"
TypeA and TypeB are essentially the same with the difference that there is discriminator kind is registered with given mapping A and B.
Then following json cannot be validated
Validator provides this error
must be valid to one and only one schema, but 2 are valid with indexes '0, 1'