-
code: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@suncpp all JSON Schema keywords can be used together, and they all have the same priority. Some of these combinations make sense, and some do not (e.g.
So people often use But if you do configure things so that |
Beta Was this translation helpful? Give feedback.
@suncpp all JSON Schema keywords can be used together, and they all have the same priority. Some of these combinations make sense, and some do not (e.g.
minimum
is superfluous in{"type": "string", "minimum": 2}
because any number will fail thetype
assertion), but none are forbidden.pattern
andformat
are often used together because depending on the draft and configuration you are using,format
may or may not behave as an assertion. And even if it does, that keyword is pretty unreliable as it's not implemented consistently.So people often use
format
as a semantic annotation (its default behavior in 2020-12) and usepattern
to do the actual validation. e.g.{"type": "string", "format": …