-
-
Notifications
You must be signed in to change notification settings - Fork 215
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 4 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,20 @@ | |
"type": "array", | ||
"items": { "$ref": "#/$defs/test" }, | ||
"minItems": 1 | ||
}, | ||
"specification":{ | ||
"description": "Location of the test case in the specification", | ||
"type": "object", | ||
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 suspect an array is more correct here actually , which would allow referencing multiple locations, perhaps even within one spec. (Or if we want to get fancy at the expense of making it harder to parse we could do 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. Concluding this, which of them is better to be chosen:
I felt first one is simpler, but doesn't mention its value is a "section" explicitely 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. Always having an array is easier to handle in some languages. 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'd go with number 1 personally.
Makes sense. 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. great |
||
"minProperties": 1, | ||
"properties": { | ||
"jsonschema-core": { "$ref": "#/$defs/spec"}, | ||
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.
Also I doubt this reference ( |
||
"jsonschema-validation": {"$ref": "#/$defs/spec"}, | ||
"ecma262": { "$ref": "#/$defs/spec"} | ||
}, | ||
"patternProperties": { | ||
"^rfc[0-9]{4}$": {"$ref": "#/$defs/spec"} | ||
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. (RFCs are not always 4 digits long.) 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 see some RFC names are defines like this: RFC 3162 (IPv6), RFC 1058 (v.1), RFC 2080 (v.ng), RFC 23 All RFC's have 2- 4 digits, most RFC's used in spec arent using aany of first three. So, just matching for digits is good? 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. Yes, probably just "1 or more digits" is fine. |
||
}, | ||
"additionalProperties": false | ||
} | ||
}, | ||
"additionalProperties": false | ||
|
@@ -56,6 +70,18 @@ | |
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"spec": { | ||
"properties": { | ||
"section": { | ||
"type": "string", | ||
"pattern": "^\\d+(\\.\\d+)*\\.$" | ||
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. This seems wrong (in that it ends in a period -- presumably that's simply a formatting period if it appears in the doc) but also too specific to me. Not all specifications will have this form of heading sections, it's perfectly believable that one will use e.g. letters in the section names, so I see @gregsdennis left you some helpful comments, I'd read those, and then probably we could even consider having different definitions of 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. The regex I left was an example, if we wanted to even enforce such a thing. Julian has a good point about section numbering not being consistent across specs. 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, sections can also contain 1.A, 1.2.B, I.V.1.a, anything right ? so we can check for only periods in between? |
||
}, | ||
"para": { | ||
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 don't like abbreviations personally, but also I don't think paragraph numbers are that much fun, they're hard both for the person writing the thing as well as the reader, both of whom have to count to find what they want. Ideally everything should have its own anchor and/or section link though certainly they do not today, but I think probably the right thing to do there is 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. Maybe this should be used sparingly, like only when the section alone isn't sufficient. I also agree with the abbreviation thing, especially considering that users of the test suite don't necessarily understand English. Abbreviations in foreign language are really hard, in general. 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. Yes definitely agree there! 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. Got this one too |
||
"type": "string", | ||
"pattern": "^\\d+(\\.\\d+)*$" | ||
} | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not just "the" specification, given it can either be the JSON Schema specification or some other specification. Probably we should elaborate here with some guidance for how to use this, specifically:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got this 👍