-
|
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.
minimumis superfluous in{"type": "string", "minimum": 2}because any number will fail thetypeassertion), but none are forbidden.patternandformatare often used together because depending on the draft and configuration you are using,formatmay 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
formatas a semantic annotation (its default behavior in 2020-12) and usepatternto do the actual validation. e.g.{"type": "string", "format": …