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

RFC: more rigid, but simpler schema validation #178

Open
bmcfee opened this issue Nov 6, 2017 · 2 comments
Open

RFC: more rigid, but simpler schema validation #178

bmcfee opened this issue Nov 6, 2017 · 2 comments
Labels
interoperability Making JAMS play nice with other packages schema Issues pertaining to schema definitions
Milestone

Comments

@bmcfee
Copy link
Contributor

bmcfee commented Nov 6, 2017

TL;DR

What if we rewrote all namespace partial schemas as proper schemas, index them in the master schema, and then say each annotation has to validate as a oneOf: [namespace1, namespace2, ...]?

More detail

We're using jsonschema in some pretty unsavory ways right now, and those ways make it harder to port jams validations into different implementations. Moreover, it makes it difficult to version the schema explicitly, which is something we really ought to do.

what would this look like?

We could specify loose annotation schemas and hard-code the namespace field to act as the indexer, so a key_mode annotation will only validate (and fast-fail) if the namespace string matches.

We'd then use $refs to link up all the namespaces we know about, and remove the dynamic loader / dispatch logic. This should make it easier to call out to other validation engines (as discussed here #170
) and port to other languages.

What we lose is the ability to release custom schema with datasets that aren't explicitly coded in the master jams schema. (You could maybe monkey-patch that, but it would be less convenient.) I don't see this as a big loss, since nobody appears to be using this functionality anyway.

What do yall think?

@bmcfee
Copy link
Contributor Author

bmcfee commented May 29, 2018

It looks like the way to do this is to use $ref tags for the different namespace definitions. Each namespace can live in a different file, which are located by the jsonschema RefResolver at validation time.

For completeness, we should have a web-hosted copy of the full schema (via gh-pages maybe?) that can be accessed universally and validated in javascript.

@bmcfee bmcfee added this to the 0.4.0 milestone May 29, 2018
@bmcfee
Copy link
Contributor Author

bmcfee commented May 31, 2018

Update: i might take a crack at this next week.

@bmcfee bmcfee added schema Issues pertaining to schema definitions interoperability Making JAMS play nice with other packages and removed question labels Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interoperability Making JAMS play nice with other packages schema Issues pertaining to schema definitions
Projects
None yet
Development

No branches or pull requests

1 participant