Can I set exact value in a JSON Schema?
Solution 1
You can:
{ "enum": [123] }
or
{ "const": 123 }
const
is now part of draft-06 of JSON schema specification (it is supported by Ajv and some other validators).
Solution 2
Already mentioned but the 2 options I know are:
{ "enum": [123] }
and
{ "const": 123 }
My source was: https://json-schema.org/understanding-json-schema/reference/generic.html
Keep up the good work!

Author by
Admin
Updated on June 13, 2022Comments
-
Admin about 2 months