Skip to content

Various language improvements #236

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 5 commits into from
Feb 1, 2017
Merged

Conversation

awwright
Copy link
Member

No description provided.

Copy link
Contributor

@handrews handrews left a comment

Choose a reason for hiding this comment

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

Nice work!

While I still think we need to sort out a lot of things about what "default" really means, I agree that "has the same behavior" is an improvement. And I don't want to delay Draft 06 for a more thorough change, so I'm in favor of this.

I have a couple of other minor comments, mostly around how schemas can now be booleans and not just objects.

@@ -167,8 +162,8 @@

<section title="Keywords and instance primitive types">
<t>
Most validation keywords only limit the range of values within a certain primitive type.
When the primitive type of the instance is not of the type targeted by the keyword, the
Most validation keywords only exclude a range of values within a certain primitive type.
Copy link
Contributor

Choose a reason for hiding this comment

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

What about

Most validation keywords only constrain values within a certain primitive type.

We've often talked about validation as a constraint system, and I think it feels more intuitive than talking about exclusion.

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 language is sort of tricky overall... revised

@@ -575,21 +559,23 @@
validates against the provided schema.
Note the property name that the schema is testing will always be a string.
</t>
<t>
A missing keyword has the same behavior as an empty schema.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we specify this as a true schema instead of an empty schema? Admittedly, the behavior is the same but true conveys the intent of permitting everything more clearly.

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 so too

Copy link
Member Author

@awwright awwright Jan 31, 2017

Choose a reason for hiding this comment

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

"empty schema" is language that was used before (that this PR doesn't introduce), can we work on this in a new PR and call this one good?

Copy link
Contributor

Choose a reason for hiding this comment

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

If empty schema vs true is the only concern, I endorse doing that in a follow-up PR. We should check for it in more places than just these lines, and that will be trivially easy to check up on on its own.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that's the thing, it's used quite a few times

</t>
<t>
Elements of the array MUST be objects. Each object MUST be a valid JSON
Schema.
Elements of the array MUST be objects.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we just want to say

Each element of the array MUST be a valid JSON Schema.

in order to allow boolean schemas as well.

</t>
<t>
Elements of the array MUST be objects. Each object MUST be a valid JSON
Schema.
Elements of the array MUST be objects.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing:

Each element of the array MUST be a valid JSON Schema.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought that's what we did at first and then it was changed back for some reason... idk. I'll do this though.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think maybe I changed it like that in a PR that I ended up dropping? The boolean schema thing went through a few variations before we settled on it. Whatever happened, I think just saying "valid JSON Schema" is the best option- we already define what that means in an obvious place (the core spec).

@@ -664,19 +650,21 @@

<section title="not">
<t>
This keyword's value MUST be an object. This object MUST be a valid JSON
Schema.
This keyword's value MUST be an object.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing:

This keyword's value MUST be a valid JSON Schema.

Of course, {"not": true} doesn't make much sense, I think it should be syntactically valid.

Copy link
Contributor

@handrews handrews left a comment

Choose a reason for hiding this comment

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

Looks great! Let's let @Relequestual and @epoberezkin weigh in since they had somewhat different opinions of the "same behavior" part, but this looks good to me.

@handrews
Copy link
Contributor

@epoberezkin , @Relequestual are y'all OK with this? I'd like to get these fixes merged if so. There is no behavior change so it doesn't need to sit open for weeks.

@Relequestual
Copy link
Member

I need more time to review this PR. I feel in some places it's actually more confusing, and I have ideas how to fix that, but I can't do it right now.

@@ -575,21 +559,23 @@
validates against the provided schema.
Note the property name that the schema is testing will always be a string.
</t>
<t>
A missing keyword has the same behavior as an empty schema.
Copy link
Member

Choose a reason for hiding this comment

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

I find the phrasing "A missing key word...", does not make me think that the missing key word in question is THIS key word (as in, the key word in where the phrase is being used).
I would much rather prefer something like "Omitting this key word has the same effect as...". I feel the intent is far clearer.

If it's just me that feels this way, please say.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's exactly the word I was looking for, actually

@awwright
Copy link
Member Author

awwright commented Feb 1, 2017

@Relequestual How's it look now

Copy link
Member

@Relequestual Relequestual left a comment

Choose a reason for hiding this comment

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

All good in my books! =D

@Relequestual
Copy link
Member

As such... I'm merging!

@Relequestual Relequestual merged commit 703c107 into json-schema-org:master Feb 1, 2017
@awwright awwright deleted the aaa-a branch February 1, 2017 15:56
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.

4 participants