-
-
Notifications
You must be signed in to change notification settings - Fork 581
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
Consider forcing end-users into explicitly selecting a format behavior once Draft 8 is out #407
Comments
So one issue I have here is that I feel somewhat strongly that most users are satisfied by the simple |
I've been thinking about this sort of thing recently. Right now, So I'm considering changing the model to say:
**application here includes anything not completely nailed down by the JSON Schema spec. So format validators, while likely packaged with implementations rather than literal applications, are considered application-level things in this sense. And some applications would provide their own format validators This is super hand-wavey but since you just mentioned something that lines up with this vague idea really well, I thought I'd float it. |
@handrews so... forgive me if I missed it, but I'm not sure I see anything but a semantic change there (one that I'm even behind on, since this library hasn't yet adopted the language of "annotations" and "assertions") -- did I miss the point? I think fundamentally the problem I see here is people don't realize The kinds of things that I think might actually help the problem here to me are things like considering a syntax change that causes pause. E.g., if optional-whosemacallits were syntactically distinct, someone might go "huh why do I spell it |
@Julian I'm reluctant to add breaking changes in terms of syntax, although I'm not entirely against it and the What I'm trying to do with the assertion/annotation/applicator keyword classifications and related things is establish a clear and predictable framework for keyword behavior. Most users won't read up on it at the spec level, but they will notice the effects. Or rather, hopefully they won't notice, because things just behave in a predictable way so they aren't surprised and don't need to care. My audience for that is not so much people who have been following along from draft to draft, but people who will be coming in new, or without having paid much attention before. Historically, if you glanced over the spec, you found But what if the spec looked like:
This gives anyone who even glances at the spec the correct impression- So instead of And we can make it a little more standardized and predictable how implementations should handle not just Even better, that's just a special case of how all annotations work: they add information to the instance, and something else has to decide how to make use of that information. That's the right mental model for Yes, people who already know |
Ah, got it, ok, so the idea is to just completely split it (and others like it) into a completely separate section. Might work. |
Yup! The section would also include (under the "basic meta-data" heading or something vaguely like that) things like There's also going to be more in the core spec about assertions and annotations, and what those things mean and what you can do with them, so there should be some context around that as well. Again, most end-users won't read all of that, but hopefully we'll get people writing some new tutorials and guides, and they are more likely to read it and be influenced by the new organization of functionality. |
Yeah agree. |
Hey, end-user here :) As you both rightfully said, not everyone goes deep in the spec. I read http://json-schema.org/understanding-json-schema/reference/string.html#format and nothing seemed fishy. After reading the thread, I now noticed that there is a small friendly blue note saying "that's not required". Honestly, I completely skipped it and went straight to what the spec offers. I was really please to see ipv4 format and tried to use it with your lib. When I noticed that "bob" was considered OK, I went through some syntax checking, spell checking, checks on other tools (that DO implement it by default: https://www.jsonschemavalidator.net/) and was really confused. That's when/why I ended up here, checking if someone reported the issue. Things I would have liked:
There's many ways one can avoid to be in this case (thorough read of docs, unit tests with failing cases), but people make mistakes. A crash is problematic, a silent validation of a wrong data is potentially catastrophic. |
fc05651cc Merge pull request #409 from Stranger6667/dd/add-jsonschema-rs 5f1575a93 Add Rust `jsonschema` crate 2bf95beec Merge pull request #407 from fisxoj/master 9ae956b21 Add common lisp implementation to the list d4ffd569b Merge pull request #401 from json-schema-org/ether/format-uuid 2d6c45711 tests for the "uuid" format 08f6cdaff Merge pull request #400 from json-schema-org/ether/more-format-ipv6 d3064eb3a some more tests for the "ipv6" format 1f34d3321 Merge pull request #399 from json-schema-org/ether/more-format-idn-email 22adda78c also test the "email" inputs against "idn-email" 25598a3b4 Merge pull request #392 from rjmill/rjmill/test-prop-named-ref-containing-a-ref 8dfa8adc9 Merge pull request #380 from ChALkeR/fix-ecmascript-regex d595dbf9d backport $ref cases, changing "$defs" to "definitions" ca8319c9e Fix \W test description 452b5f8f4 Test property named $ref, containing an actual $ref a01ae5404 Fix ECMA 262 regex whitespace tests. git-subtree-dir: json git-subtree-split: fc05651cce3889975f8dbcca38c203d6a396694b
There's a note about this in the FAQ which I've updated (quite awhile ago now). @LukeMarlin and others I agree with most of the feedback here -- in newer drafts the way to be more explicit is I think the feedback about Understanding JSON Schema is likely good too, do take it upstream. For now though I don't see much more to do here locally in the library, so going to close for now beyond getting |
See the discussion in #403 -- it might be worthwhile (i.e. it might remove some footgunning) to force even users who do not want
format
to do anything to have to opt into that by passing in an emptyFormatChecker
.Let's wait here though until Draft 8 is out, since one of its focuses is to further classify things in a way that makes these things generally applicable.
The text was updated successfully, but these errors were encountered: