-
-
Notifications
You must be signed in to change notification settings - Fork 220
draft-04/06: items/additionalItems tests #161
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 1 commit
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 |
---|---|---|
|
@@ -19,6 +19,14 @@ | |
"description": "ignores non-arrays", | ||
"data": {"foo" : "bar"}, | ||
"valid": true | ||
}, | ||
{ | ||
"description": "not array is valid", | ||
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 one is redundant with "ignores non-arrays" above it for what I can tell, unless you're testing something different here, but not seeing it? 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. Same here I think? 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. That is relevant for Javascript validators (almost half of all validators) that do not differentiate between arrays and pseudo-array (objects that look like and can be iterated as arrays). Objects should pass even if a similar array would fail. Quite a few validators fail this test. 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 it, can you update the description to mention that specifically? This seems even more likely to be JS-specific given the presence of the "length" key, so maybe this one should specifically say something like "Javascript pseudo-arrays are not valid", and it seems likely that that edge case belongs elsewhere as well then possibly. And if we're already going there, maybe having integer-keyed maps entirely is another reasonable test (i.e. the same as what you have, just without the length key.). |
||
"data": { | ||
"0": "invalid", | ||
"length": 1 | ||
}, | ||
"valid": true | ||
} | ||
] | ||
}, | ||
|
@@ -55,6 +63,15 @@ | |
"description": "empty array", | ||
"data": [ ], | ||
"valid": true | ||
}, | ||
{ | ||
"description": "not array is valid", | ||
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. And here? 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. see comment above about pseudo arrays |
||
"data": { | ||
"0": "invalid", | ||
"1": "valid", | ||
"length": 2 | ||
}, | ||
"valid": true | ||
} | ||
] | ||
} | ||
|
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.
The spirit of this is redundant with the test below it for "no additional items present", but if you feel like it's worth having separate tests for "less than" than "equal" it might be nice to reword the descriptions in that way 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.
The test below tests array with the same number of items. This tests for array with FEWER items. While it should pass and may seem redundant, some validators fail this test.
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.
@Julian could you please suggest the description?
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.
Maybe "fewer number of items present" and "equal number of items present" is good enough.
It's mostly the generality of the description below that seems out of place to me now, since it says "no additional items present" but that applies mostly equally to this test case.