diff --git a/rules/from-draft3/to-draft4/001-ref-and-adjecent-keywords-present.json b/rules/from-draft3/to-draft4/001-ref-and-adjecent-keywords-present.json new file mode 100644 index 0000000..bbb03f4 --- /dev/null +++ b/rules/from-draft3/to-draft4/001-ref-and-adjecent-keywords-present.json @@ -0,0 +1,10 @@ +{ + "vocabulary": "core", + "condition": [ + { "operation": "has-key", "path": [], "value": "$ref" }, + { "operation": "type-is", "path": [ {} ], "value": [ "array", "booelan", "integer", "number", "object", "string" ] } + ], + "transform": [ + { "operation": "prefix-until-unique", "path": [ {} ], "value": "x-" } + ] +} diff --git a/rules/from-draft3/to-draft4/002-ref-and-x-ref-present.json b/rules/from-draft3/to-draft4/002-ref-and-x-ref-present.json new file mode 100644 index 0000000..5e482fa --- /dev/null +++ b/rules/from-draft3/to-draft4/002-ref-and-x-ref-present.json @@ -0,0 +1,10 @@ +{ + "vocabulary": "core", + "condition": [ + { "operation": "has-key", "path": [], "value": "$ref" }, + { "operation": "has-key", "path": [], "value": "x-$ref" } + ], + "transform": [ + { "operation": "prefix-until-unique", "path": [ "x-$ref" ], "value": "x-" } + ] +} diff --git a/rules/from-draft3/to-draft4/003-correct-sideeffects-ref-transform.json b/rules/from-draft3/to-draft4/003-correct-sideeffects-ref-transform.json new file mode 100644 index 0000000..56ba6d3 --- /dev/null +++ b/rules/from-draft3/to-draft4/003-correct-sideeffects-ref-transform.json @@ -0,0 +1,9 @@ +{ + "vocabulary": "core", + "condition": [ + { "operation": "has-key", "path": [], "value": "x-$ref" } + ], + "transform": [ + { "operation": "move", "to": [ "$ref" ], "from": [ "x-$ref" ] } + ] +} diff --git a/rules/from-draft3/to-draft4/002-unknown-in-previous-draft-anyOf.json b/rules/from-draft3/to-draft4/004-unknown-in-previous-draft-anyOf.json similarity index 100% rename from rules/from-draft3/to-draft4/002-unknown-in-previous-draft-anyOf.json rename to rules/from-draft3/to-draft4/004-unknown-in-previous-draft-anyOf.json diff --git a/rules/from-draft3/to-draft4/003-unknown-in-previous-draft-allOf.json b/rules/from-draft3/to-draft4/005-unknown-in-previous-draft-allOf.json similarity index 100% rename from rules/from-draft3/to-draft4/003-unknown-in-previous-draft-allOf.json rename to rules/from-draft3/to-draft4/005-unknown-in-previous-draft-allOf.json diff --git a/rules/from-draft3/to-draft4/004-unknown-in-previous-draft-oneOf.json b/rules/from-draft3/to-draft4/006-unknown-in-previous-draft-oneOf.json similarity index 100% rename from rules/from-draft3/to-draft4/004-unknown-in-previous-draft-oneOf.json rename to rules/from-draft3/to-draft4/006-unknown-in-previous-draft-oneOf.json diff --git a/rules/from-draft3/to-draft4/005-unknown-in-previous-draft-not.json b/rules/from-draft3/to-draft4/007-unknown-in-previous-draft-not.json similarity index 100% rename from rules/from-draft3/to-draft4/005-unknown-in-previous-draft-not.json rename to rules/from-draft3/to-draft4/007-unknown-in-previous-draft-not.json diff --git a/rules/from-draft3/to-draft4/006-unknown-in-previous-draft-definitions.json b/rules/from-draft3/to-draft4/008-unknown-in-previous-draft-definitions.json similarity index 100% rename from rules/from-draft3/to-draft4/006-unknown-in-previous-draft-definitions.json rename to rules/from-draft3/to-draft4/008-unknown-in-previous-draft-definitions.json diff --git a/rules/from-draft3/to-draft4/007-unknown-in-previous-draft-maxProperties.json b/rules/from-draft3/to-draft4/009-unknown-in-previous-draft-maxProperties.json similarity index 100% rename from rules/from-draft3/to-draft4/007-unknown-in-previous-draft-maxProperties.json rename to rules/from-draft3/to-draft4/009-unknown-in-previous-draft-maxProperties.json diff --git a/rules/from-draft3/to-draft4/008-unknown-in-previous-draft-minProperties.json b/rules/from-draft3/to-draft4/010-unknown-in-previous-draft-minProperties.json similarity index 100% rename from rules/from-draft3/to-draft4/008-unknown-in-previous-draft-minProperties.json rename to rules/from-draft3/to-draft4/010-unknown-in-previous-draft-minProperties.json diff --git a/rules/from-draft3/to-draft4/009-schema.json b/rules/from-draft3/to-draft4/011-schema.json similarity index 100% rename from rules/from-draft3/to-draft4/009-schema.json rename to rules/from-draft3/to-draft4/011-schema.json diff --git a/rules/from-draft3/to-draft4/010-type-has-value-equals-any.json b/rules/from-draft3/to-draft4/012-type-has-value-equals-any.json similarity index 100% rename from rules/from-draft3/to-draft4/010-type-has-value-equals-any.json rename to rules/from-draft3/to-draft4/012-type-has-value-equals-any.json diff --git a/rules/from-draft3/to-draft4/011-type-has-any-in-its-array.json b/rules/from-draft3/to-draft4/013-type-has-any-in-its-array.json similarity index 100% rename from rules/from-draft3/to-draft4/011-type-has-any-in-its-array.json rename to rules/from-draft3/to-draft4/013-type-has-any-in-its-array.json diff --git a/rules/from-draft3/to-draft4/012-type-has-atleast-one-object-in-its-array-anyOf-absent.json b/rules/from-draft3/to-draft4/014-type-has-atleast-one-object-in-its-array-anyOf-absent.json similarity index 100% rename from rules/from-draft3/to-draft4/012-type-has-atleast-one-object-in-its-array-anyOf-absent.json rename to rules/from-draft3/to-draft4/014-type-has-atleast-one-object-in-its-array-anyOf-absent.json diff --git a/rules/from-draft3/to-draft4/013-type-has-objects-and-strings-in-its-array-initialize.json b/rules/from-draft3/to-draft4/015-type-has-objects-and-strings-in-its-array-initialize.json similarity index 100% rename from rules/from-draft3/to-draft4/013-type-has-objects-and-strings-in-its-array-initialize.json rename to rules/from-draft3/to-draft4/015-type-has-objects-and-strings-in-its-array-initialize.json diff --git a/rules/from-draft3/to-draft4/016-type-has-objects-and-strings-in-its-array.json b/rules/from-draft3/to-draft4/016-type-has-objects-and-strings-in-its-array.json index 6f7b851..9140836 100644 --- a/rules/from-draft3/to-draft4/016-type-has-objects-and-strings-in-its-array.json +++ b/rules/from-draft3/to-draft4/016-type-has-objects-and-strings-in-its-array.json @@ -7,6 +7,6 @@ { "operation": "type-is", "path": [ "type", {} ], "value": "string" } ], "transform": [ - { "operation": "remove", "path": [ "type", {} ] } + { "operation": "copy", "to": [ "anyOf", "-", "type", "-" ], "from": [ "type", {} ] } ] } diff --git a/rules/from-draft3/to-draft4/015-type-has-objects-in-its-array.json b/rules/from-draft3/to-draft4/017-type-has-objects-in-its-array.json similarity index 100% rename from rules/from-draft3/to-draft4/015-type-has-objects-in-its-array.json rename to rules/from-draft3/to-draft4/017-type-has-objects-in-its-array.json diff --git a/rules/from-draft3/to-draft4/014-type-has-objects-and-strings-in-its-array.json b/rules/from-draft3/to-draft4/018-type-has-objects-and-strings-in-its-array.json similarity index 80% rename from rules/from-draft3/to-draft4/014-type-has-objects-and-strings-in-its-array.json rename to rules/from-draft3/to-draft4/018-type-has-objects-and-strings-in-its-array.json index 9140836..6f7b851 100644 --- a/rules/from-draft3/to-draft4/014-type-has-objects-and-strings-in-its-array.json +++ b/rules/from-draft3/to-draft4/018-type-has-objects-and-strings-in-its-array.json @@ -7,6 +7,6 @@ { "operation": "type-is", "path": [ "type", {} ], "value": "string" } ], "transform": [ - { "operation": "copy", "to": [ "anyOf", "-", "type", "-" ], "from": [ "type", {} ] } + { "operation": "remove", "path": [ "type", {} ] } ] } diff --git a/rules/from-draft3/to-draft4/017-type-has-boolean-in-its-array.json b/rules/from-draft3/to-draft4/019-type-has-boolean-in-its-array.json similarity index 100% rename from rules/from-draft3/to-draft4/017-type-has-boolean-in-its-array.json rename to rules/from-draft3/to-draft4/019-type-has-boolean-in-its-array.json diff --git a/rules/from-draft3/to-draft4/017-type-is-an-empty-array.json b/rules/from-draft3/to-draft4/020-type-is-an-empty-array.json similarity index 100% rename from rules/from-draft3/to-draft4/017-type-is-an-empty-array.json rename to rules/from-draft3/to-draft4/020-type-is-an-empty-array.json diff --git a/rules/from-draft3/to-draft4/018-disallow-has-value-equals-any.json b/rules/from-draft3/to-draft4/021-disallow-has-value-equals-any.json similarity index 100% rename from rules/from-draft3/to-draft4/018-disallow-has-value-equals-any.json rename to rules/from-draft3/to-draft4/021-disallow-has-value-equals-any.json diff --git a/rules/from-draft3/to-draft4/019-disallow-has-any-in-its-array.json b/rules/from-draft3/to-draft4/022-disallow-has-any-in-its-array.json similarity index 100% rename from rules/from-draft3/to-draft4/019-disallow-has-any-in-its-array.json rename to rules/from-draft3/to-draft4/022-disallow-has-any-in-its-array.json diff --git a/rules/from-draft3/to-draft4/020-disallow-has-atleast-one-object-in-its-array-initialize-allOf.json b/rules/from-draft3/to-draft4/023-disallow-has-atleast-one-object-in-its-array-initialize-allOf.json similarity index 100% rename from rules/from-draft3/to-draft4/020-disallow-has-atleast-one-object-in-its-array-initialize-allOf.json rename to rules/from-draft3/to-draft4/023-disallow-has-atleast-one-object-in-its-array-initialize-allOf.json diff --git a/rules/from-draft3/to-draft4/021-disallow-has-atleast-one-object-in-its-array.json b/rules/from-draft3/to-draft4/024-disallow-has-atleast-one-object-in-its-array.json similarity index 100% rename from rules/from-draft3/to-draft4/021-disallow-has-atleast-one-object-in-its-array.json rename to rules/from-draft3/to-draft4/024-disallow-has-atleast-one-object-in-its-array.json diff --git a/rules/from-draft3/to-draft4/022-disallow-is-an-array-of-strings-allOf-present.json b/rules/from-draft3/to-draft4/025-disallow-is-an-array-of-strings-allOf-present.json similarity index 100% rename from rules/from-draft3/to-draft4/022-disallow-is-an-array-of-strings-allOf-present.json rename to rules/from-draft3/to-draft4/025-disallow-is-an-array-of-strings-allOf-present.json diff --git a/rules/from-draft3/to-draft4/023-disallow-is-an-array-of-strings-allOf-absent.json b/rules/from-draft3/to-draft4/026-disallow-is-an-array-of-strings-allOf-absent.json similarity index 100% rename from rules/from-draft3/to-draft4/023-disallow-is-an-array-of-strings-allOf-absent.json rename to rules/from-draft3/to-draft4/026-disallow-is-an-array-of-strings-allOf-absent.json diff --git a/rules/from-draft3/to-draft4/024-disallow-is-an-empty-array.json b/rules/from-draft3/to-draft4/027-disallow-is-an-empty-array.json similarity index 100% rename from rules/from-draft3/to-draft4/024-disallow-is-an-empty-array.json rename to rules/from-draft3/to-draft4/027-disallow-is-an-empty-array.json diff --git a/rules/from-draft3/to-draft4/025-dependencies-children-have-type-string.json b/rules/from-draft3/to-draft4/028-dependencies-children-have-type-string.json similarity index 100% rename from rules/from-draft3/to-draft4/025-dependencies-children-have-type-string.json rename to rules/from-draft3/to-draft4/028-dependencies-children-have-type-string.json diff --git a/rules/from-draft3/to-draft4/026-divisiblyBy.json b/rules/from-draft3/to-draft4/029-divisiblyBy.json similarity index 100% rename from rules/from-draft3/to-draft4/026-divisiblyBy.json rename to rules/from-draft3/to-draft4/029-divisiblyBy.json diff --git a/rules/from-draft3/to-draft4/027-extends-is-an-array-allOf-absent.json b/rules/from-draft3/to-draft4/030-extends-is-an-array-allOf-absent.json similarity index 100% rename from rules/from-draft3/to-draft4/027-extends-is-an-array-allOf-absent.json rename to rules/from-draft3/to-draft4/030-extends-is-an-array-allOf-absent.json diff --git a/rules/from-draft3/to-draft4/028-extends-is-an-array-allOf-present.json b/rules/from-draft3/to-draft4/031-extends-is-an-array-allOf-present.json similarity index 100% rename from rules/from-draft3/to-draft4/028-extends-is-an-array-allOf-present.json rename to rules/from-draft3/to-draft4/031-extends-is-an-array-allOf-present.json diff --git a/rules/from-draft3/to-draft4/029-extends-is-an-object-allOf-absent.json b/rules/from-draft3/to-draft4/032-extends-is-an-object-allOf-absent.json similarity index 100% rename from rules/from-draft3/to-draft4/029-extends-is-an-object-allOf-absent.json rename to rules/from-draft3/to-draft4/032-extends-is-an-object-allOf-absent.json diff --git a/rules/from-draft3/to-draft4/030-extends-is-an-object-allOf-present.json b/rules/from-draft3/to-draft4/033-extends-is-an-object-allOf-present.json similarity index 100% rename from rules/from-draft3/to-draft4/030-extends-is-an-object-allOf-present.json rename to rules/from-draft3/to-draft4/033-extends-is-an-object-allOf-present.json diff --git a/rules/from-draft3/to-draft4/031-empty-extends-array.json b/rules/from-draft3/to-draft4/034-empty-extends-array.json similarity index 100% rename from rules/from-draft3/to-draft4/031-empty-extends-array.json rename to rules/from-draft3/to-draft4/034-empty-extends-array.json diff --git a/rules/from-draft3/to-draft4/032-required-false-present-in-properties's-values.json b/rules/from-draft3/to-draft4/035-required-false-present-in-properties's-values.json similarity index 100% rename from rules/from-draft3/to-draft4/032-required-false-present-in-properties's-values.json rename to rules/from-draft3/to-draft4/035-required-false-present-in-properties's-values.json diff --git a/rules/from-draft3/to-draft4/033-required-is-present-in-outer-schema.json b/rules/from-draft3/to-draft4/036-required-is-present-in-outer-schema.json similarity index 100% rename from rules/from-draft3/to-draft4/033-required-is-present-in-outer-schema.json rename to rules/from-draft3/to-draft4/036-required-is-present-in-outer-schema.json diff --git a/rules/from-draft3/to-draft4/034-required-is-absent-in-outer-schema-and-required-true-in-properties.json b/rules/from-draft3/to-draft4/037-required-is-absent-in-outer-schema-and-required-true-in-properties.json similarity index 100% rename from rules/from-draft3/to-draft4/034-required-is-absent-in-outer-schema-and-required-true-in-properties.json rename to rules/from-draft3/to-draft4/037-required-is-absent-in-outer-schema-and-required-true-in-properties.json diff --git a/rules/from-draft3/to-draft4/035-required-true-present-in-properties's-values.json b/rules/from-draft3/to-draft4/038-required-true-present-in-properties's-values.json similarity index 100% rename from rules/from-draft3/to-draft4/035-required-true-present-in-properties's-values.json rename to rules/from-draft3/to-draft4/038-required-true-present-in-properties's-values.json diff --git a/rules/from-draft3/to-draft4/036-empty-required-array-in-outer-schema.json b/rules/from-draft3/to-draft4/039-empty-required-array-in-outer-schema.json similarity index 100% rename from rules/from-draft3/to-draft4/036-empty-required-array-in-outer-schema.json rename to rules/from-draft3/to-draft4/039-empty-required-array-in-outer-schema.json diff --git a/test/from-draft3/to-draft4/ref.json b/test/from-draft3/to-draft4/ref.json new file mode 100644 index 0000000..c75fda1 --- /dev/null +++ b/test/from-draft3/to-draft4/ref.json @@ -0,0 +1,31 @@ +[ + { + "title": "$ref present in schema, with adjacent keywords", + "from": { + "id": "http://example.com", + "properties": { + "foo": { + "$ref": "/bar", + "type": "string", + "id": "zoo" + }, + "bar": { + "id": "bar" + } + } + }, + "to": { + "id": "http://example.com", + "properties": { + "foo": { + "$ref": "/bar", + "x-type": "string", + "x-id": "zoo" + }, + "bar": { + "id": "bar" + } + } + } + } +]