Skip to content
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

Allow an empty array for "required". #112

Merged
merged 1 commit into from
Nov 16, 2016

Conversation

handrews
Copy link
Contributor

This addresses the enhancement requested in issue #69.

@handrews
Copy link
Contributor Author

handrews commented Nov 4, 2016

Paging everyone on issue #69: @awwright @Relequestual @gibson042 @epoberezkin @erosb

This seemed uncontroversial by the time the discussion stopped. Any three out of the five of you willing to give approval so this can get merged?

@epoberezkin
Copy link
Member

I agree. But why don't we allow array in dependencies to be empty too in this case? For consistency sake?

@handrews
Copy link
Contributor Author

handrews commented Nov 4, 2016

But why don't we allow array in dependencies to be empty too in this case? For consistency sake?

Feel free to make another pull request, or I can make one after this is accepted, but please don't block this one because it doesn't do more stuff. The issue was about allowing an empty "required" array. We should still do this even if someone else objects about dependencies.

@gibson042
Copy link

Paging everyone on issue #69: @awwright @Relequestual @gibson042 @epoberezkin @erosb

I doubt my approval matters, but +1.

@erosb
Copy link

erosb commented Nov 6, 2016

Okey, +1

@@ -117,7 +119,7 @@
"additionalProperties": {
"anyOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/stringArray" }
{ "$ref": "#/definitions/nonEmptyStringArray" }
Copy link
Member

Choose a reason for hiding this comment

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

Why is "dependencies" being modified here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Search and replace error, good catch. (although some want this done, I'd rather keep this focused on requirements unless there's immediate agreement to do it for dependencies as well- otherwise I'll fix this to just be for requirements as intended).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, wait, actually this is correct. I decided that "stringArray" made more sense as an unrestricted array of strings, and then re-named the one with a requirement of at least one element nonEmptyStringArray.

So this actually does not change the behavior of dependencies. It is the same, but requirements is changed because plan "stringArray" was redefined.

For people who will be reading this for the first time, I think this is more clear, but I can flip it if you prefer.

Copy link
Member

Choose a reason for hiding this comment

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

I think this change makes sense.

Copy link
Member

Choose a reason for hiding this comment

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

We could also consider if both dependencies and required should allow any number of items.

They effectively do the same thing, after all.

@awwright
Copy link
Member

I'd like to just modify "stringArray" so both "dependencies" properties and "required" allows multiple items. They're both used for the same purpose, we should probably modify this behavior together.

@handrews
Copy link
Contributor Author

@awwright @epoberezkin dependencies now also allows for an empty array, which makes all string array definitions consistent.

@Relequestual
Copy link
Member

Should the wording make clear that the array may be an empty array?

This addresses the enhancement requested in issue json-schema-org#69.

The "requirements" and "dependencies" string arrays should be
allowed to be empty, with the same effect as not being present.
@handrews
Copy link
Contributor Author

Should the wording make clear that the array may be an empty array?

Done, for both keywords.

@awwright awwright merged commit b5afae7 into json-schema-org:master Nov 16, 2016
@handrews handrews deleted the emptyreq branch November 17, 2016 19:39
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.

6 participants