sourcemeta / alterschema

Convert between JSON Schema specification versions
https://alterschema.sourcemeta.com
GNU Affero General Public License v3.0
65 stars 7 forks source link

Support transforming Draft3 schemas #83

Open jviotti opened 1 year ago

jviotti commented 1 year ago

To support upgrading arbitrary draft 3 schemas, we need to define rules to upgrade draft 3 to draft 4.

jviotti commented 1 year ago

I have almost zero experience with draft3, so I'll be pasting my findings here so anybody can correct me if I'm getting any of it wrong.

jviotti commented 1 year ago

One key piece of Alterschema is teaching the tool how to "walk" over all the subschemas of a given schema by definition all possible applicator keywords. From skimming https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-03, all the keywords that take subschemas in some way are:

See https://github.com/sourcemeta/alterschema/pull/86 for my initial definition take.

jviotti commented 1 year ago

As per the rules, these are my findings so far (I'll be updating this comment with new findings):

jeremyfiel commented 1 year ago

I'm going to mix in a bit of draft 2 and 3 references to build a timeline of some of the keywords.

I'm no expert, so please correct me if i'm wrong.

 **Dependencies**
  Two types available: 
  Simple Dependency  If the dependency value is a string, then the
  instance object MUST have a property with the same name as the
  dependency value.  If the dependency value is an array of strings,
  then the instance object MUST have a property with the same name
  as each string in the dependency value's array.

  Schema Dependency  If the dependency value is a schema, then the
  instance object MUST be valid against the schema
jeremyfiel commented 1 year ago

@jviotti You mentioned other work on adjacent projects would support this work, has there been any movement on those projects?

jviotti commented 1 year ago

@jeremyfiel Yes, there is! I'm implementing some dialect-agnostic JSON Schema foundations here: https://www.jsontoolkit.org. The idea is for that project to eventually replace the engine we have here, so we can:

Feel free to watch that repo. Definitely not forgetting about this issue. I promise it will be fixed once those things are in place.