-
-
Notifications
You must be signed in to change notification settings - Fork 207
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
Add $schema to 2019-09 and 2020-12, update README for draft configuration. #586
Conversation
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.
Cursory glance through these looks good to me. I'll run these through my validator soon-ish.
EDIT: yes, all tests still pass ✔️
Nice, thanks! README changes seem fine to me, will have a last look in a bit -- did you also re-add the optional test not containing |
Oops forgot about this, I'll look into it and update the PR. |
minLength is identical across all drafts, and highly unlikely to ever change, so regardless of how an implementation chooses to process this schema, if it processes it at all the behavior should be consistent. Also, TIL that "type" has *not* always been the same - in the first few drafts it was always an array of types *or schemas*! While we don't even have test suites for those drafts, it seemed better to use a keyword that has never changed.
@Julian updated with optional tests. TIL that |
@Julian now I'm realizing that the remotes need draft-specific |
These will be updated with proper "$schema"s in the next commit
It is not necessary to add "$schema" to embedded schema resources unless the value would be different.
OK, I've looked into the remotes situation, including how
With Option 2, instead of loading from the "remotes" dir, you always load from a particular draft dir (or symlink). Option 1 pros: No changes to Option 2 pros: Remote referencing would be stable across drafts, except for the meta-schema remotes which already have the draft in their URI and would probably stay that way (which might require some tweaks as the remotes/draft20NN-NN directories would be treated as the root so if we want a draft directory in the remote meta-schema we'd need another layer of directories, but that's trivial to fix) I have a slight preference for Option 2, because most remote URIs do not need to be draft-specific even if the actual remote in use names a specific draft in |
I would suggest that we explicitly document (i.e. in the README) that |
Including an unnecessary and contradictory "$schema"
Option 2 is I think already something we've wanted (at least myself and I think @karenetheridge and a few others in PRs) but perhaps best to do that in a separate PR and keep the minimum amount of changes here. I think for Option2 we anyways have to update some duplication as well. Certainly if you're willing to help with that it's welcome though. |
I think I probably agree about |
@Julian so should I implement option 1 for now, or put this on hold until the necessary support for Option 2 (whoever ends up implementing it) is in place? Regarding draft-next, do we expect implementations to understand |
Do option 1 here, we merge, and then if you're still interested, a follow up PR for option 2 after.
Yes (explicitly saying so in docs is #554, but it's already expected in existing tests). |
There's an extra "problem" in the current suite according to the assertions made in #574 that implementations may not enable additional vocabularies, namely that the Given that I'm moving things around in the |
@Julian good to know. I will try to wrap this PR as soon as I can up since it is touching so many files. As far as the So those tests should be as valid as they were in 2019-09, which also had the "by default assertion behavior is off, but it can be turned on by some sort of unique configuration option." The difference with the format-assertion vocabulary is that the assertion behavior is mandatory, and the expectation of how much validation happens is higher (but still does not mandate complete coverage, because someone objected to that I guess, I don't remember). |
@Julian I know that |
Sounds like a mistake/poorly chosen fake base URI but can look later when at a computer. I want to add a sanity check that ensures files other than |
@Julian a lot of files reference localhost. What should they be referencing instead? I can fix that (at least for 2019-09, 2020-12 and draft-next) if you'd like, but mostly I'm asking because I'm wondering if I'm missing something here. I know a lot of the localhost references do not point to actual files, but I was updating all of the URIs consistently (references and ids). |
I think this is now complete — @gregsdennis if you'd be willing to run the suite with your validator again that would be fantastic. I still don't have anything set up to run and I just wanted to get the PR to a complete state. If no one has time to run this, I'll set it up, but it may take a few more days. |
The suite runs fine. Caveat: The optional 2019-09 This definitely is an issue in my implementation, not anything about this PR. |
Is this waiting on anything else? If not I think you can merge at will, I didn't look at the URI question yet but we can handle in a follow up, as you said they could use some cleanup but it doesn't have to happen simultaneously here, if this sits around it's liable to produce merge conflicts. |
Oh, we should add a sanity check I guess, enforcing that root schemas all have this in these directories, but we can do that in a follow up as well if needed. |
@Julian yes, I was just waiting to make sure you were OK with the further work on the remotes and draft-next. Let's defer the sanity check and other cleanup to later PRs. @karenetheridge technically merging is blocked because you requested changes and have not re-approved, even though requested change has been resolved. Since it has been resolved, I'm going to go ahead and merge anyway given the high possibility of conflicts with further work if it stays open. |
Fixes #311. To recap so folks don't have to dig through that whole discussion:
$schema
, therefore all tests for 2019-09 and 2020-12 need to have the correct$schema
$schema
to determine behavior was only a MAY, and therefore cannot be used to control the behavior of required tests$schema
to control behavior, and nothing indicates that an implementation can refuse to process a$schema
-less schema, therefore adding$schema
does not provide benefits over the long-standing practice of configuring the draft based on the directory name.Therefore, we are only adding
$schema
to 2019-09 and 2020-12. I am unsure what to do with draft-next, as there is certainly no normative language around detecting unpublished work, so I have not added$schema
to those tests, and do not plan to unless someone makes an argument in favor of that.@Julian I updated the README as best I could, but I would be happy to change it. I think it's important to convey that 2019-09 and later are intended to function through
$schema
-detection (particularly since that is a change), but I avoided mandating the behavior.