-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce flag noAdditionalProperties
This will default `additionalProperties` to `false` for all objects in the schema if set to `true`. The `additionalProperties` annotation, `schemaRoot.additionalProperties` and additionalProperties set via other ways (nested in `itemProperties`, `patternProperties` or similar) will take precedence over this setting, so it's fully backwards compatible. Closes #95.
- Loading branch information
1 parent
6d1e5b0
commit 114bd03
Showing
9 changed files
with
144 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"additionalProperties": false, | ||
"properties": { | ||
"object": { | ||
"additionalProperties": false, | ||
"properties": {}, | ||
"type": "object" | ||
}, | ||
"objectOfObjects": { | ||
"additionalProperties": false, | ||
"patternProperties": { | ||
"^.*$": { | ||
"type": "object" | ||
} | ||
}, | ||
"properties": {}, | ||
"type": "object" | ||
}, | ||
"objectOfObjectsWithInnerAdditionalPropertiesAllowed": { | ||
"additionalProperties": false, | ||
"patternProperties": { | ||
"^.*$": { | ||
"additionalProperties": true, | ||
"type": "object" | ||
} | ||
}, | ||
"properties": {}, | ||
"type": "object" | ||
}, | ||
"objectWithAdditionalPropertiesAllowed": { | ||
"additionalProperties": true, | ||
"properties": {}, | ||
"type": "object" | ||
} | ||
}, | ||
"type": "object" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
object: {} | ||
objectWithAdditionalPropertiesAllowed: {} # @schema additionalProperties: true | ||
objectOfObjects: {} # @schema patternProperties: { "^.*$": {"type": "object" } } | ||
objectOfObjectsWithInnerAdditionalPropertiesAllowed: {} # @schema patternProperties: { "^.*$": {"type": "object", "additionalProperties": true }} |