Skip to content

JSON Schema & Atomic Schema #1099

@joepio

Description

@joepio

These two specs have some interesting similarities and differences. Let's explore them both and think about potential compatibility. I want to either move Atomic Schema towards JSON Schema, or make some small changes to JSON Schema, or have good reasons to keep both separate.

Comparison

Both JSON Schema and Atomic Schema:

  • Make JSON type-safe
  • Support linking to schema definitions (in JSON Schema you can share one schema using $ref, in Atomic Schema using isA
  • Are open
  • Have JS + Rust implementations
  • Are self-describing (JSON Schema, Atomic)

Only JSON Schema:

  • Supports complicated JSON objects, like arrays of certain types of objects
  • Has far more other implementations (python, go etc)

Only Atomic Schema:

  • Supports de-referencing properties (all keys are HTTP URLs). This is probably one of the biggest differences, and quite fundamental to Atomic Data. The idea is that it is useful to re-use properties in multiple classes. As far as I know this is not a thing in JSON Schema
  • Has clear expectations about the protocol for fetching and browsing the data. Every key needs to resolve with an application/ad+json request, it has expectations about authentication, etc.

Ways to make both interoperable

Generate JSON Schema from Atomic Schema

This would allow other languages to easily validate their Atomic Data client-side, even if there is no library available.

  • Add /endpoints/json-schema which takes a class, property or ontology and generates a JSON schema that resolves.

Get rid of Atomic Schema altogether, depend on JSON Schema

  • Could we still retrieve JSON Schema definitions for properties and use these to render form fields? If that is the case, maybe this is a legit path forward.

Allow JSON datatype + JSON Schema property

  • Add an implementation that downloads the referenced schema (could happen recursively)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions