Skip to content

Commit 321bc3f

Browse files
romansavchenkomcollina
authored andcommitted
Issue 134 - Clarify docs on additionalProperties (#135)
* docs additionalProperties=false is a special case Clarification in the docs. #132 * Spelling * Readme wording for additional properties updated
1 parent 5fa8ad3 commit 321bc3f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ console.log(stringify(obj)) // '{"matchfoo":"42","otherfoo":"str","matchnum":3,"
227227
*additionalProperties* must be an object or a boolean, declared in this way: `{ type: 'type' }`.
228228
*additionalProperties* will work only for the properties that are not explicitly listed in the *properties* and *patternProperties* objects.
229229

230-
If *additionalProperties* is not present or is set to `false`, every property that is not explicitly listed in the *properties* and *patternProperties* objects,will be ignored, as described in <a href="#missingFields">Missing fields</a>.
230+
If *additionalProperties* is not present or is set to `false`, every property that is not explicitly listed in the *properties* and *patternProperties* objects,will be ignored, as described in <a href="#missingFields">Missing fields</a>.
231+
Missing fields are ignored to avoid having to rewrite objects before serializing. However, other schema rules would throw in similar situations.
231232
If *additionalProperties* is set to `true`, it will be used by `JSON.stringify` to stringify the additional properties. If you want to achieve maximum performance, we strongly encourage you to use a fixed schema where possible.
232233
Example:
233234
```javascript

0 commit comments

Comments
 (0)