json-schema-spec icon indicating copy to clipboard operation
json-schema-spec copied to clipboard

same vocabulary meta schema behaviour

Open ItsVeryWindy opened this issue 4 years ago • 2 comments

If you have a meta schema that references multiple vocabularies, and say two of them define semantics for the same keyword.

How is the behaviour determined?

  • Would both be evaluated, or
  • Is it based on the order defined, or
  • The schema would be considered invalid, or
  • Possibly something I haven't considered

As a bad example, lets say the keyword was minLength, and one vocabulary defines it as being the length of a string, while the other determines it to be the minimum number of items in an array.

ItsVeryWindy avatar Dec 07 '21 23:12 ItsVeryWindy

I think this enters into the namespacing territory that @jdesrosiers has mentioned before.

It's not something that is addressed in the spec, and TBH we haven't had a good case for needing to define it yet.

gregsdennis avatar Dec 07 '21 23:12 gregsdennis

You can't use two vocabularies with conflicting keyword names in the same dialect. Technically, the spec says the behavior is undefined, so the behavior depends on the implementation and you should never rely on that behavior.

We've talked about enhancements/changes to the vocabulary system that could address this problem, but those discussions are on the back burner for now.

jdesrosiers avatar Dec 07 '21 23:12 jdesrosiers

I'm closing this as the question has been answered (the undefined explanation is in Appendix D, and proposals for change should be their own issues.

handrews avatar Aug 13 '22 23:08 handrews