The "$ref" keyword is an applicator that is used to reference a
statically identified schema. Its results are the results of the
referenced schema. [[CREF9: Note that this definition of how the
results are determined means that other keywords can appear alongside
of "$ref" in the same schema object. ]]
The application programmer and the schema author need to agree on the
usage.
So, ideally, the library would provide some options for how to deal with multiple values if the referenced schema also included the title keyword. e.g., prefer local or prefer referenced.
From 2019-09 spec section 8.2.4.1
I tried this out using
Newtonsoft.Json.Schema 3.0.14
dotnet fiddle of the code belowThis program outputs
and then throws
I would expect it to produce a valid schema that can be reparsed.
It may be worth noting that the expected schema is up to the application developer and the schema author to agree on. See section 7.7.1.1 Distinguishing Among Multiple Values
So, ideally, the library would provide some options for how to deal with multiple values if the referenced schema also included the title keyword. e.g., prefer local or prefer referenced.