diff --git a/package.json b/package.json index 1afcf090..e60bd5ef 100644 --- a/package.json +++ b/package.json @@ -83,8 +83,9 @@ "eslint-plugin-react": "^7.21.5", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-simple-import-sort": "^5.0.2", + "fast-glob": "^3.2.4", "jest": "^26.6.2", - "jest-enzyme": "7.1.2", + "jest-enzyme": "^7.1.2", "mobx": "^5.13.0", "prettier": "^2.2.1", "react": "^16.14.0", diff --git a/src/__fixtures__/allOf/allOf-resolved.json b/src/__fixtures__/allOf/allOf-resolved.json deleted file mode 100644 index aa0e6446..00000000 --- a/src/__fixtures__/allOf/allOf-resolved.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "type": "object", - "properties": { - "AllOfMergeObjects": { - "allOf": [ - { - "properties": { - "Object1Property": { - "type": "string", - "minLength": 1, - "x-val": "lol" - } - } - }, - { - "properties": { - "Object2Property": { - "type": "number", - "maximum": 2 - } - } - } - ], - "type": "object" - }, - "AllOfMergeValidations": { - "allOf": [ - { - "minLength": 1 - }, - { - "maxLength": 2 - } - ], - "type": "string" - }, - "AllOfMergeTakeMoreLogicalValidation": { - "allOf": [ - { - "maximum": 1 - }, - { - "maximum": 2 - } - ], - "type": "number" - }, - "AllOfMergeObjectPropertyValidations": { - "allOf": [ - { - "properties": { - "Property": { - "type": "string", - "minLength": 1 - } - } - }, - { - "properties": { - "Property": { - "type": "string", - "maxLength": 2 - } - } - } - ], - "type": "object" - }, - "AllOfMergeRemovesUnresolvedRefs": { - "allOf": [ - { - "type": "object", - "properties": { - "street_address": { - "type": "string" - }, - "city": { - "type": "string" - }, - "state": { - "type": "string" - } - }, - "required": ["street_address", "city", "state"] - }, - { "$ref": "#/definitions/ref1" } - ] - } - } -} diff --git a/src/__fixtures__/array-of-allofs.json b/src/__fixtures__/arrays/of-allofs.json similarity index 100% rename from src/__fixtures__/array-of-allofs.json rename to src/__fixtures__/arrays/of-allofs.json diff --git a/src/__fixtures__/arrays/of-arrays.json b/src/__fixtures__/arrays/of-arrays.json new file mode 100644 index 00000000..58891b18 --- /dev/null +++ b/src/__fixtures__/arrays/of-arrays.json @@ -0,0 +1,17 @@ +{ + "type": "array", + "items": { + "type": "object", + "properties": { + "bar": { + "type": "integer" + }, + "foo": { + "type": "array", + "items": { + "type": "array" + } + } + } + } +} diff --git a/src/__fixtures__/array-of-objects.json b/src/__fixtures__/arrays/of-objects.json similarity index 100% rename from src/__fixtures__/array-of-objects.json rename to src/__fixtures__/arrays/of-objects.json diff --git a/src/__fixtures__/array-of-refs.json b/src/__fixtures__/arrays/of-refs.json similarity index 100% rename from src/__fixtures__/array-of-refs.json rename to src/__fixtures__/arrays/of-refs.json diff --git a/src/__fixtures__/arrays/with-multiple-arrayish-items.json b/src/__fixtures__/arrays/with-multiple-arrayish-items.json new file mode 100644 index 00000000..e45d26da --- /dev/null +++ b/src/__fixtures__/arrays/with-multiple-arrayish-items.json @@ -0,0 +1,26 @@ +{ + "type": "array", + "items": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "code": { + "type": "number" + }, + "msg": { + "type": "string" + }, + "ref": { + "type": "string" + } + }, + "required": [ + "code", + "msg" + ] + } + ] +} diff --git a/src/__fixtures__/arrays/with-ordered-items.json b/src/__fixtures__/arrays/with-ordered-items.json new file mode 100644 index 00000000..0273e023 --- /dev/null +++ b/src/__fixtures__/arrays/with-ordered-items.json @@ -0,0 +1,11 @@ +{ + "type": "array", + "items": [ + { + "type": "number" + }, + { + "type": "string" + } + ] +} diff --git a/src/__fixtures__/arrays/with-single-arrayish-items.json b/src/__fixtures__/arrays/with-single-arrayish-items.json new file mode 100644 index 00000000..f15e8d3d --- /dev/null +++ b/src/__fixtures__/arrays/with-single-arrayish-items.json @@ -0,0 +1,23 @@ +{ + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "code": { + "type": "number" + }, + "msg": { + "type": "string" + }, + "ref": { + "type": "string" + } + }, + "required": [ + "code", + "msg" + ] + } + ] +} diff --git a/src/__fixtures__/allOf/allOf-schema.json b/src/__fixtures__/combiners/allOfs/base.json similarity index 100% rename from src/__fixtures__/allOf/allOf-schema.json rename to src/__fixtures__/combiners/allOfs/base.json diff --git a/src/__fixtures__/complex-allOf-model.json b/src/__fixtures__/combiners/allOfs/complex.json similarity index 100% rename from src/__fixtures__/complex-allOf-model.json rename to src/__fixtures__/combiners/allOfs/complex.json diff --git a/src/__fixtures__/combiner-schema.json b/src/__fixtures__/combiners/allOfs/todo-full-2.json similarity index 100% rename from src/__fixtures__/combiner-schema.json rename to src/__fixtures__/combiners/allOfs/todo-full-2.json diff --git a/src/__fixtures__/todo-allof.schema.json b/src/__fixtures__/combiners/allOfs/todo-full.json similarity index 100% rename from src/__fixtures__/todo-allof.schema.json rename to src/__fixtures__/combiners/allOfs/todo-full.json diff --git a/src/__fixtures__/allof-with-type.json b/src/__fixtures__/combiners/allOfs/with-type.json similarity index 100% rename from src/__fixtures__/allof-with-type.json rename to src/__fixtures__/combiners/allOfs/with-type.json diff --git a/src/__fixtures__/oneof-with-array-type.json b/src/__fixtures__/combiners/oneof-with-array-type.json similarity index 100% rename from src/__fixtures__/oneof-with-array-type.json rename to src/__fixtures__/combiners/oneof-with-array-type.json diff --git a/src/__fixtures__/ref/resolved.json b/src/__fixtures__/ref/resolved.json deleted file mode 100644 index 796b3586..00000000 --- a/src/__fixtures__/ref/resolved.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "address": { - "type": "object", - "properties": { - "street_address": { - "type": "string" - }, - "city": { - "type": "string" - }, - "state": { - "type": "string" - } - }, - "required": [ - "street_address", - "city", - "state" - ] - } - }, - "type": "object", - "properties": { - "billing_address": { - "type": "object", - "properties": { - "street_address": { - "type": "string" - }, - "city": { - "type": "string" - }, - "state": { - "type": "string" - } - }, - "required": [ - "street_address", - "city", - "state" - ] - }, - "shipping_address": { - "type": "object", - "properties": { - "street_address": { - "type": "string" - }, - "city": { - "type": "string" - }, - "state": { - "type": "string" - } - }, - "required": [ - "street_address", - "city", - "state" - ] - } - } -} diff --git a/src/__fixtures__/ref/original.json b/src/__fixtures__/references/base.json similarity index 100% rename from src/__fixtures__/ref/original.json rename to src/__fixtures__/references/base.json diff --git a/src/__fixtures__/nullish-ref.schema.json b/src/__fixtures__/references/nullish.json similarity index 100% rename from src/__fixtures__/nullish-ref.schema.json rename to src/__fixtures__/references/nullish.json diff --git a/src/__tests__/__snapshots__/index.spec.tsx.snap b/src/__tests__/__snapshots__/index.spec.tsx.snap index de406367..830c5d95 100644 --- a/src/__tests__/__snapshots__/index.spec.tsx.snap +++ b/src/__tests__/__snapshots__/index.spec.tsx.snap @@ -1176,18 +1176,14 @@ exports[`HTML Output given write mode, should populate proper nodes 1`] = ` " `; -exports[`HTML Output should match allof-with-type.json 1`] = ` +exports[`HTML Output should match arrays/of-allofs.json 1`] = ` "