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

Support more recent drafts #23

Open
adeschamps opened this issue Oct 1, 2019 · 5 comments
Open

Support more recent drafts #23

adeschamps opened this issue Oct 1, 2019 · 5 comments

Comments

@adeschamps
Copy link
Contributor

Schemafy currently supports draft 4. What would be involved in updating to support the more recent drafts? Is this something I might be able to take on?

@Marwes
Copy link
Owner

Marwes commented Oct 1, 2019

I don't know how much has changed with the newer revisions but to get started you can try to update schema.json with a newer draft, regenerate the rust module representing a JSON schma according to https://github.com/Marwes/schemafy#development and then chase down the compile errors that occurs.

Supporting multiple, incompatible drafts could be possible but I doubt it is worth it.

@handrews
Copy link

handrews commented Oct 1, 2019

@adeschamps @Marwes I would definitely focus on the newly released draft-handrews-json-schema-02 / draft-handrews-json-schema-validation-02, a.k.a. draft 2019-09.

The cumulative changes between draft-04 and this draft (which would have been draft-08 if we hadn't changed the numbering scheme to dates b/c it got confusing) are significant, but we expect 2019-09 to be a stable platform with only modest changes or compatible extensions before finalization.

2019-09 includes mechanisms for interoperable extensions without having to put every extension into the spec. 2019-09 will also be adopted by OpenAPI 3.1, which means that OpenAPI will move beyond its current state of semi-compatability with draft-04 for the first time. We expect that to drive further adoption and development, as it is probably the largest complex application of JSON Schema.

@adeschamps
Copy link
Contributor Author

In order to get started on this, #3 needs to be implemented first; the new draft is basically an allOf clause that refers to other schemas.

@handrews
Copy link

handrews commented Oct 4, 2019

@adeschamps yeah, that has to do with modularizing the keyword vocabularies.

Several implementations that I know of require the user to pass in all of the filenames (or parsed data structures, or whatever the interface is) up front. And then when they hit a $ref they just look at the set of schemas (specifically their $id values) that are already loaded to resolve it.

That's a lot easier than actually implementing file or http or whatever retrieval. It's also more flexible if your $ids are https:// but you're actually working with local file copies.

(my apologies if you already knew this- it was a point we've tried to clarify so people understand what they are and aren't responsible for to make a conforming implementation)

@adeschamps
Copy link
Contributor Author

No, that's actually very helpful. It didn't occur to me that you could pass all the files upfront and that making http calls is not a requirement. That drastically simplifies things.

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

No branches or pull requests

3 participants