RFC: more rigid, but simpler schema validation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 209
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names namespace partial schemas, the master schema, and the dynamic loader or dispatch logic, but gives no file or test paths. Start by locating those components and reviewing the current jsonschema behavior. Done would mean the agreed schema structure, namespace indexing, references, versioning, and loader changes are implemented and validated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100