UNPKG

alterschema

Version:

Convert between schema specifications

74 lines (73 loc) 1.99 kB
{ "walker": "jsonschema-draft6", "rules": [ { "vocabulary": "core", "condition": { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://github.com/sourcemeta/alterschema/rules/jsonschema-draft6-to-draft7/upgrade-official-metaschema", "type": "object", "required": [ "$schema" ], "properties": { "$schema": { "const": "http://json-schema.org/draft-06/schema#" } } }, "transform": { "$merge": [ { "$eval": "schema" }, { "$$schema": "http://json-schema.org/draft-07/schema#" } ] } }, { "vocabulary": "core", "condition": { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://github.com/sourcemeta/alterschema/rules/jsonschema-draft6-to-draft7/empty-object", "const": {} }, "transform": { "$eval": "true" } }, { "vocabulary": "core", "condition": { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://github.com/sourcemeta/alterschema/rules/jsonschema-draft6-to-draft7/negated-empty-object", "const": { "not": true } }, "transform": { "$eval": "false" } }, { "vocabulary": "validation", "condition": { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://github.com/sourcemeta/alterschema/rules/jsonschema-draft6-to-draft7/enum-to-const", "type": "object", "required": [ "enum" ], "properties": { "enum": { "type": "array", "minItems": 1, "maxItems": 1 } } }, "transform": { "$merge": [ { "$eval": "omit(schema, 'enum')" }, { "const": { "$eval": "schema.enum[0]" } } ] } } ] }