Constant valuesΒΆ
New in draft 6
The const
keyword is used to restrict a value to a single value.
For example, if you only support shipping to the United States for export reasons:
schema
1
{2
"properties": {3
"country": {4
"const": "United States of America"5
}6
}7
}data
1
{ "country": "United States of America" }compliant to schema
data
1
{ "country": "Canada" }not compliant to schema