Skip to content

Commit fca988b

Browse files
committed
Add "const" keyword for constant values.
This addresses issue json-schema-org#58, which got quite a few upvotes and has a "draft 6" milestone. I used the shorter "const" that several people suggested rather than "constant", but obviously that's easy to change if the longer form is preferred. The wording was pretty much directly lifted from "enum".
1 parent 5340c4b commit fca988b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

jsonschema-validation.xml

+10
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,16 @@
546546
</t>
547547
</section>
548548

549+
<section title="const">
550+
<t>
551+
The value of this keyword MAY be of any type, including null.
552+
</t>
553+
<t>
554+
An instance validates successfully against this keyword if its value is
555+
equal to the value of the keyword.
556+
</t>
557+
</section>
558+
549559
<section title="type">
550560
<t>
551561
The value of this keyword MUST be either a string or an array. If it is

schema.json

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@
124124
]
125125
}
126126
},
127+
"const": {},
127128
"enum": {
128129
"type": "array",
129130
"minItems": 1,

0 commit comments

Comments
 (0)