Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add requireAllExcept keyword #1144

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions jsonschema-validation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,28 @@
<eref target="https://json-schema.org/draft/next/meta/validation"/>.
</t>

<section title="Keyword Independence">
<t>
Schema keywords typically operate independently, without
affecting each other's outcomes.
</t>
<t>
For schema author convenience, there are some exceptions among the
keywords in this vocabulary:
<list>
<t>
"requireAllExcept", whose behavior is defined in terms of "properties"
</t>
<t>
"minContains", whose behavior is defined in terms of "contains"
</t>
<t>
"maxContains", whose behavior is defined in terms of "contains"
jdesrosiers marked this conversation as resolved.
Show resolved Hide resolved
</t>
</list>
</t>
</section>

<section title="Validation Keywords for Any Instance Type" anchor="general">
<section title="type">
<t>
Expand Down Expand Up @@ -493,6 +515,21 @@
</t>
</section>

<section title="requireAllExcept">
<t>
The value of this keyword MUST be an array.
Elements of this array, if any, MUST be strings, and MUST be unique.
jdesrosiers marked this conversation as resolved.
Show resolved Hide resolved
</t>
<t>
This keyword specifies properties that are required based on the property
names declared in a "properties" keyword within the same schema object.
The set of required properites is the set of property names declared in
"properties" minus the set of property names declared in this keyword's
array. An object instance is valid against this keyword if it has defined
properties for each of the property names in this set of required properties.
</t>
</section>

<section title="dependentRequired">
<t>
The value of this keyword MUST be an object. Properties in
Expand Down Expand Up @@ -1445,6 +1482,7 @@
<t hangText="draft-next">
<list style="symbols">
<t>Use IRIs instead of URIs</t>
<t>Add the "requireAllExcept" keyword</t>
</list>
</t>
<t hangText="draft-bhutton-json-schema-validation-01">
Expand Down
1 change: 1 addition & 0 deletions meta/validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"maxProperties": { "$ref": "#/$defs/nonNegativeInteger" },
"minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
"required": { "$ref": "#/$defs/stringArray" },
"requireAllExcept": { "$ref": "#/$defs/stringArray" },
"dependentRequired": {
"type": "object",
"additionalProperties": {
Expand Down