marl / marl/jams

RFC: more rigid, but simpler schema validation

Open
#178 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interoperability schema
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.