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

Create an Applicators section, group into a Keyword Behaviors section #595

Merged
merged 5 commits into from
Jun 21, 2018

Conversation

handrews
Copy link
Contributor

NOTE: The second commit in this PR indents for a new section without changing the text, so it's best to look at each commit separately.

This is groundwork for more of the vocabulary and annotation
collection process work.

Move the general description of applicators from the applicator
vocabulary to a section alongside the Assertion and Annotation
sections. Rework the text a bit, and also clarify an aspect
of annotation collection related to applicators.

Group the Annotation, Assertion, and Application sections
as Keyword Behaviors.

Arguably, this has overgrown the "Overview" section, but since
the "Vocabulary" part of the overview is also about to be
expanded, let's wait until then to figure out how to refactor it.

handrews added 4 commits May 25, 2018 15:00
Move the general description of applicators from the applicator
vocabulary to a section alongside the Assertion and Annotation
sections.  Rework the text a bit, and also clarify an aspect
of annotation collection related to applicators.
This is purely a reformatting plus the new section tags,
no text has been changed.

Group the Annotation, Assertion, and Application sections.
This new section will get an intro paragraph in the next commit.

Arguably, this has overgrown the "Overview" section, but since
the "Vocabulary" part of the overview is also about to be
expanded, let's wait until then to figure out how to refactor it.
This attempts to explain the general framework for keywords
and provide guidance on creating new keywords with respect
to that framework.
@handrews handrews added this to the draft-08 milestone May 26, 2018
either passes or fails the assertions. This approach can be used to validate
conformance with the constraints, or document what is needed to satisfy them.
JSON Schema keywords fall into several general behavior categories.
Assertions validate that an instance satisfies constraints, annotations
Copy link
Member

Choose a reason for hiding this comment

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

I'd break this into three sentences.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. Do you think sentences work well for it, or should I make a little bullet-point list? I've gone back and forth on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated- I went with sentences for now.

JSON Schema keywords fall into several general behavior categories.
Assertions validate that an instance satisfies constraints, annotations
attach information that applications may use in any way they see fit,
and applicators allow for building more complex schemas than a single
Copy link
Member

Choose a reason for hiding this comment

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

Would it be accurate to say something like "Applicators allow a sub-schema to be applied recursively to some part of the instance, or the entire instance." ?
The current description wasn't clear to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so? Applicators are not inherently recursive. I mean, you can do that by using $ref in particular, but just applying properties or items for one level does not fit that description.

"allow for building more complex schemas" is definitely vague, but the rest of the section is supposed to explain it in more detail.

Copy link
Member

Choose a reason for hiding this comment

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

Well maybe not "recursive"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Throughout these PRs (and earlier changes) I classify applicators as "in-place" or "child" applicators. I would not say "the entire instance" because people will take that to mean the whole instance document, which may be a much larger chunk of JSON than the current location.

Just saying "Applicators allow a sub-schema to be applied to some part of the instance." might be fine, though? We'd just leave the enumeration of the different locations to the more detailed explanation.

primitive type. When the type of the instance is not of the type
targeted by the keyword, the instance is considered to conform
to the assertion.
Evaluation of an instance against a
Copy link
Member

Choose a reason for hiding this comment

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

Is there a difference between "evaluation" and "application"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm... yes that's unclear. There is a difference, I'll add some text in the Keyword Behaviors intro section about it.

@awwright
Copy link
Member

Also, you can now change the diff settings within GitHub to ignore whitespace \o/

@awwright
Copy link
Member

Also this section would be a good place to remark on the existence of "argument keywords" (for lack of a better term), properties in the schema that do nothing by themselves, but are used by other keywords, or affect the behavior of other keywords. The old boolean form of "exclusiveMinimum"/"exclusiveMaximum" would be the best example of this.

@handrews
Copy link
Contributor Author

Also, you can now change the diff settings within GitHub to ignore whitespace \o/

I did not know that! Ah, I see you can only do it while looking at an individual diff.

I will continue putting whitespace-only changes in their own commit, which is what i did here.

@handrews
Copy link
Contributor Author

Also this section would be a good place to remark on the existence of "argument keywords" (for lack of a better term), properties in the schema that do nothing by themselves, but are used by other keywords, or affect the behavior of other keywords. The old boolean form of "exclusiveMinimum"/"exclusiveMaximum" would be the best example of this.

Take a look at PR #600. That kind of effect can be defined in terms of annotation behavior, which keeps it all within a simpler theoretical framework.

I also think that modifiers like the boolean exclusive* approach are a really bad idea and don't want to encourage them by codifying such an approach. After being phrased in terms of annotations, the additional* keywords stop seeming like such weird exceptions. Although, for performance reasons, I expect they will often be implemented as weird exceptions.

@handrews
Copy link
Contributor Author

@awwright could you see if my changes address your concerns and let me know? A lot of other work is stacked up on this PR so it would be great to get it merged.

@handrews handrews merged commit bc84825 into json-schema-org:master Jun 21, 2018
@handrews handrews deleted the applicator branch June 21, 2018 04:43
@ghost ghost deleted a comment Oct 21, 2022
@gregsdennis gregsdennis added clarification Items that need to be clarified in the specification and removed Type: Maintenance labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Items that need to be clarified in the specification core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants