This repository has been archived by the owner on Jan 27, 2022. It is now read-only.
Refactor approach to generating .schema.json
from .schema.yaml
#41
Labels
JSON Schema doesn't have good support for inheritance (i.e. extending/overriding properties defined in other schemas). There are several problems that arise from our current use of the
allOf
approach:additionalProperties: false
type
property with another constants e.g.CreativeWork
can't overrideThing
The proposed solution is to introduce a
$extends
keyword and do pre-processing to merge the properties of the base and current types. This would include auto-population of some fields to make schema authoring less tedious and error prone and to add information for docs generation:$schema
- alwayshttp://json-schema.org/draft-07/schema#
$id
- populated withhttps://stencila.github.com/schema/${schema.title}.schema.json
properties.type.enum
- populated with[${schema.title}]
properties
- merged from the base and currentproperties.*.inherited
- populated with title of type that they were inherited fromrequired
- merged from the base and current andtype
addedadditionalProperties: false
- if not specifiedThe text was updated successfully, but these errors were encountered: