-
-
Notifications
You must be signed in to change notification settings - Fork 280
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
make format validate by default #1553
Conversation
jsonschema-validation.md
Outdated
to any instance types defined in the data model defined in the [core JSON | ||
Schema.](#json-schema)[^1] | ||
The value of this keyword MUST be a string. While this keyword can validate any | ||
type, each distinct value will generally only validate a given set of instance |
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.
If I'm reading this correctly, it means we let format
apply to instances other than strings. If I recall correctly, the JSON Schema test suite very explicitly tests that format
only applies to instances, which might be a change that could confuse various people and implementations.
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.
If I'm reading this correctly, it means we let format apply to instances other than strings.
Yes, format
can apply to instances of any type. This isn't a new feature, however, the spec only defines formats that apply to strings.
This being a breaking change and a potentially controversial one, I think there should be a TSC vote to formally document that we have consensus before this moves forward. It should also have an ADR to document the decision. |
I'll add one.
I'll create a TSC voting issue summarizing this PR. |
2c9cae4
to
e13e156
Compare
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.
I have a few editorial suggestions, but otherwise, this looks great.
Co-authored-by: Jason Desrosiers <[email protected]>
Co-authored-by: Jason Desrosiers <[email protected]>
Co-authored-by: Jason Desrosiers <[email protected]>
Co-authored-by: Jason Desrosiers <[email protected]>
I was initially concerned with some of the wording and the implication for required or optional tests, but it was changed, and I'm now happy. Sharing after the merge as @gregsdennis asked on the TSC vote issue for me to do so, although that was a week ago (sorry). (Partly for my own records
I was concerned the "SHOULD" was too weak here, but the proceeding "MUST" gives it enough balance. Primarily, this avoids any false positives where a user expects assertion behavior and an implementation goes "shrugs I'll just allow it". |
What kind of change does this PR introduce?
Feature update
Issue & Discussion References
Closes #1520
Depends on json-schema-org/TSC#19
Summary
Makes
format
an assertion to align with user expectations.Quick notes:
format
with the defined valuesDoes this PR introduce a breaking change?
Technically a breaking change, but aligns to user expectations. So... ????