Skip to content

Commit d648e8b

Browse files
authored
Add additionalProperties: false note (SchemaStore#4755)
1 parent 929a9ad commit d648e8b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

CONTRIBUTING.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ The goal of JSON Schemas in this repository is to correctly validate schemas tha
109109

110110
#### Avoiding Overconstraint
111111

112+
##### Complexity
113+
112114
Sometimes, constraints do more harm than good. For example, [cron strings](http://pubs.opengroup.org/onlinepubs/7908799/xcu/crontab.html) validation regexes. In general, do not add a constraint if:
113115

114116
- false positives are likely (due to their complexity or abundance of implementations)
@@ -120,7 +122,21 @@ So, we recommend avoiding regex patterns for:
120122
- string-embedded DSLs
121123
- SSH URLs, HTTPS URLs, and other complex URIs
122124

123-
In addition, be wary when adding exhaustive support to enum-type fields (without a `"type": "string"` fallback). Often, when applications expand support (thus expanding the set of allowable enums), the schema will become invalid.
125+
##### Enums
126+
127+
Be wary when adding exhaustive support to enum-type fields (without a `"type": "string"` fallback). Keep in mind:
128+
129+
- New enum values that are supported by a new tool version (and not yet added to SchemaStore) should _not_ error
130+
- The schema may be extended by a tool that you have no knowledge of
131+
132+
##### Properties
133+
134+
Do not blindly add `"additionalProperties": false`. Keep in mind that:
135+
136+
- New properties that are supported by a new tool version (and not yet added to SchemaStore) should _not_ error
137+
- The schema may be extended by a tool that you have no knowledge of
138+
139+
It is recognized that stricter checking may be desired, as in the case of checking for typos. In that case, check to see if your validator has an option for stronger checks. For example, [Tombi](https://tombi-toml.github.io/tombi) enables a [strict mode](https://tombi-toml.github.io/tombi/docs/json-schema#strict-mode) by default.
124140

125141
#### Undocumented Features
126142

0 commit comments

Comments
 (0)