-
-
Notifications
You must be signed in to change notification settings - Fork 219
adding specification enhancement for additionalProperties 2020-12 #726
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
Changes from all commits
50a2028
003ac02
340116e
1362a8c
9b169be
51fc69c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,69 @@ | |
"type": "array", | ||
"items": { "$ref": "#/$defs/test" }, | ||
"minItems": 1 | ||
}, | ||
"specification":{ | ||
"description": "A reference to a specification document which defines the behavior tested by this test case. Typically this should be a JSON Schema specification document, though in cases where the JSON Schema specification points to another RFC it should contain *both* the portion of the JSON Schema specification which indicates what RFC (and section) to follow as *well* as information on where in that specification the behavior is specified.", | ||
|
||
"type": "array", | ||
"minItems": 1, | ||
"uniqueItems": true, | ||
"items":{ | ||
"properties": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think all the values here will be (should be) strings, so probably you can/should use |
||
"core": { | ||
"description": "A section in official JSON Schema core drafts", | ||
"url": "https://json-schema.org/specification-links", | ||
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$", | ||
"type":"string" | ||
}, | ||
"validation": { | ||
"description": "A section in official JSON Schema validation drafts", | ||
"url": "https://json-schema.org/specification-links", | ||
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$", | ||
"type":"string" | ||
}, | ||
"ecma262": { | ||
"description": "A section in official ECMA 262 specification for defining regular expressions", | ||
"url": "https://262.ecma-international.org/", | ||
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$", | ||
"type":"string" | ||
}, | ||
"perl5": { | ||
"description": "A section name in Perl documentation for defining regular expressions", | ||
"url": "https://perldoc.perl.org/perlre", | ||
"type":"string" | ||
}, | ||
"quote": { | ||
"description": "Quote describing the test case", | ||
"type":"string" | ||
} | ||
}, | ||
"patternProperties": { | ||
"^rfc\\d+$": { | ||
"description": "A section in official RFC for the given rfc number", | ||
"url": "https://www.rfc-editor.org/", | ||
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$", | ||
"type":"string" | ||
}, | ||
"^iso\\d+$": { | ||
"description": "A section in official ISO for the given iso number", | ||
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$", | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": { "type": "string" }, | ||
"minProperties": 1, | ||
"propertyNames": { | ||
"oneOf": [ | ||
{ | ||
"pattern": "^((iso)|(rfc))[0-9]+$" | ||
}, | ||
{ | ||
"enum": [ "core", "validation", "ecma262", "perl5", "quote" ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering we need this enum and that IIRC |
||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
{ | ||
"description": | ||
"additionalProperties being false does not allow other properties", | ||
"specification": [ { "core":"10.3.2.3", "quote": "The value of \"additionalProperties\" MUST be a valid JSON Schema. Boolean \"false\" forbids everything." } ], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A good follow up (to this ticket, perhaps even before we go much further) would be to make CI annotate pull requests with links to the section. It'd be a lot easier to check whether this was correct if something were annotating the review with a link to this section. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, for each version of the draft, we should add different "baseURI's" right which should append and check whether the the redirection to the section is failing or not? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably custom logic for each specification which knows what the right URL is given what we have put in the corresponding field, yes, which the simplest version is just "a base URI". But exactly right. Some CI script for that, which annotates PRs, and warns for broken links. Can you perhaps immediately open an issue at least so we don't forget about it? Then yeah if you give it a shot that'd be amazing. |
||
"schema": { | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"properties": {"foo": {}, "bar": {}}, | ||
|
@@ -43,6 +44,7 @@ | |
}, | ||
{ | ||
"description": "non-ASCII pattern with additionalProperties", | ||
"specification": [ { "core":"10.3.2.3"} ], | ||
"schema": { | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"patternProperties": {"^á": {}}, | ||
|
@@ -63,6 +65,7 @@ | |
}, | ||
{ | ||
"description": "additionalProperties with schema", | ||
"specification": [ { "core":"10.3.2.3", "quote": "The value of \"additionalProperties\" MUST be a valid JSON Schema." } ], | ||
"schema": { | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"properties": {"foo": {}, "bar": {}}, | ||
|
@@ -87,8 +90,8 @@ | |
] | ||
}, | ||
{ | ||
"description": | ||
"additionalProperties can exist by itself", | ||
"description": "additionalProperties can exist by itself", | ||
"specification": [ { "core":"10.3.2.3", "quote": "With no other applicator applying to object instances. This validates all the instance values irrespective of their property names" } ], | ||
"schema": { | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"additionalProperties": {"type": "boolean"} | ||
|
@@ -108,6 +111,7 @@ | |
}, | ||
{ | ||
"description": "additionalProperties are allowed by default", | ||
"specification": [ { "core":"10.3.2.3", "quote": "Omitting this keyword has the same assertion behavior as an empty schema." } ], | ||
"schema": { | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"properties": {"foo": {}, "bar": {}} | ||
|
@@ -122,6 +126,7 @@ | |
}, | ||
{ | ||
"description": "additionalProperties does not look in applicators", | ||
"specification":[ { "core": "10.2", "quote": "Subschemas of applicator keywords evaluate the instance completely independently such that the results of one such subschema MUST NOT impact the results of sibling subschemas." } ], | ||
"schema": { | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"allOf": [ | ||
|
@@ -139,6 +144,7 @@ | |
}, | ||
{ | ||
"description": "additionalProperties with null valued instance properties", | ||
"specification": [ { "core":"10.3.2.3" } ], | ||
"schema": { | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"additionalProperties": { | ||
|
Uh oh!
There was an error while loading. Please reload this page.