Skip to content

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

Merged
merged 2 commits into from
Feb 25, 2017
Merged

draft-04/06: items/additionalItems tests #161

merged 2 commits into from
Feb 25, 2017

Conversation

epoberezkin
Copy link
Member

No description provided.

Copy link
Member

@Julian Julian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think these are all redundant, with the possible exception of <= vs <, but lemme know if you disagree?

@@ -40,6 +40,11 @@
},
"tests": [
{
"description": "fewer items is valid",
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

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?

Copy link
Member

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.

@@ -19,6 +19,14 @@
"description": "ignores non-arrays",
"data": {"foo" : "bar"},
"valid": true
},
{
"description": "not array is valid",
Copy link
Member

Choose a reason for hiding this comment

The 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?

@@ -19,6 +19,14 @@
"description": "ignores non-arrays",
"data": {"foo" : "bar"},
"valid": true
},
{
"description": "not array is valid",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here I think?

Copy link
Member Author

@epoberezkin epoberezkin Feb 6, 2017

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The 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.).

@@ -55,6 +63,15 @@
"description": "empty array",
"data": [ ],
"valid": true
},
{
"description": "not array is valid",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment above about pseudo arrays

@awwright
Copy link
Member

awwright commented Feb 6, 2017 via email

@Julian
Copy link
Member

Julian commented Feb 6, 2017

@awwright think it got lost which test you're specifically referring to here with that comment

@epoberezkin
Copy link
Member Author

@Julian thank you for the feedback, I've pushed the changes.

Copy link
Member

@Julian Julian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@epoberezkin
Copy link
Member Author

@awwright are you ok with that?

I don't think pseudo-array tests should be in optional because even though they specifically target JavaScript validators, these tests MUST pass for all validators, irrespective of the language, so they are not really "optional". Currently in this folder we have tests that validators SHOULD (or MAY?) pass, not MUST pass.

@epoberezkin epoberezkin merged commit e7c1f4e into json-schema-org:master Feb 25, 2017
@epoberezkin epoberezkin deleted the items branch March 12, 2017 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants