I have a Json Schema in a single file with multiple objects. root object is not defined and I have only objects in $defs. Could you please suggest how to validate a json against these defintions? E.g. from schema below, how to validate an object against schema which would "start" at #/$defs/Object1VariantA or #/$defs/Object1VariantB or #/$defs/Object1VariantC?
From my point of view nothing wrong could happen if there's a way to start validation from a specific definition, not from the top. This is not a canonical way to do that, but I haven't found anything in json schema RFCs which tells, that validation should start only from the top (#/ reference).
I can't alter the schema, or create multiple files around. Schema below is a very small part of the original one to show the relevant example.
Schema example (in yaml format, as it's way easier for me to write it):
Hi,
I have a Json Schema in a single file with multiple objects. root object is not defined and I have only objects in
$defs
. Could you please suggest how to validate a json against these defintions? E.g. from schema below, how to validate an object against schema which would "start" at#/$defs/Object1VariantA
or#/$defs/Object1VariantB
or#/$defs/Object1VariantC
?From my point of view nothing wrong could happen if there's a way to start validation from a specific definition, not from the top. This is not a canonical way to do that, but I haven't found anything in json schema RFCs which tells, that validation should start only from the top (
#/
reference).I can't alter the schema, or create multiple files around. Schema below is a very small part of the original one to show the relevant example.
Schema example (in yaml format, as it's way easier for me to write it):