Tools, FAQ, Tutorials:
Generic JSON Schema Validation Keywords
What are other generic JSON Schema validation keywords?
✍: FYIcenter.com
Several other generic JSON Schema validation keywords are listed below.
They are always applied to the JSON instance.
"enum" - The JSON instance must match one of the elements in the given array. For example,
JSON Schema:
{"enum": ["YES", "NO"]}
Valid JSON instance:
"YES"
Invalid JSON instance:
"Yes"
Invalid JSON instance:
3.14
"const" - The JSON instance must match the given value. For example,
JSON Schema:
{"const": 3.14}
Valid JSON instance:
3.14
Invalid JSON instance:
3.14159
Invalid JSON instance:
"PI"
"allOf" - The JSON instance must be valid against all schemas in the given array. For example,
JSON Schema:
{"allOf": [
{"type": "number"},
{"const": 3.14}
]}
Valid JSON instance:
3.14
Invalid JSON instance:
3.14159
Invalid JSON instance:
"PI"
"anyOf" - The JSON instance must be valid against at least one schema in the given array. For example,
JSON Schema:
{"anyOf": [
{"const": "YES"},
{"const": "NO"}
]}
Valid JSON instance:
"YES"
Invalid JSON instance:
"Yes"
Invalid JSON instance:
3.14
"oneOf" - The JSON instance must be valid against at exactly one schema in the given array. For example,
JSON Schema:
{"oneOf": [
{"type": "integer"},
{"type": "number"}
]}
Valid JSON instance:
1.00
Invalid JSON instance:
1
Invalid JSON instance:
"One"
"not" - The JSON instance must be invalid against the given schema. For example,
JSON Schema:
{"not":
{"type": "integer"},
}
Valid JSON instance:
1.00
Valid JSON instance:
"One"
Invalid JSON instance:
1
⇒ Multiple JSON Schema Validation Keywords
2017-08-25, ∼2213🔥, 0💬
Popular Posts:
Can Two Forms Be Nested? Can two forms be nested? The answer is no and yes: No. You can not nest two...
How To Merge Cells in a Column? If you want to merge multiple cells vertically in a row, you need to...
How to install "The Windows SDK version 8.1"? I need to build my Visual Studio C++ applications. If ...
How to use the "find-and-replace" Policy Statement for an Azure API service operation? The "find-and...
What is Azure API Management Developer Portal? Azure API Management Developer Portal is an Azure Web...