@adobe/jsonschema2md 6.1.4 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{.eslintrc.js → .eslintrc.cjs} +3 -17
- package/{.releaserc.js → .releaserc.cjs} +0 -0
- package/CHANGELOG.md +26 -0
- package/cli.js +1 -1
- package/lib/formatInfo.js +17 -19
- package/lib/formattingTools.js +6 -8
- package/lib/index.js +176 -81
- package/lib/keywords.js +2 -4
- package/lib/locales/update.js +2 -2
- package/lib/markdownBuilder.js +62 -44
- package/lib/readmeBuilder.js +15 -15
- package/lib/schemaProxy.js +32 -26
- package/lib/symbols.js +14 -2
- package/lib/traverseSchema.js +5 -5
- package/lib/writeMarkdown.js +87 -41
- package/lib/writeSchema.js +46 -21
- package/package.json +39 -28
- package/types/api.d.ts +72 -0
- package/types/formatInfo.d.ts +19 -0
- package/types/formattingTools.d.ts +2 -0
- package/types/index.d.ts +75 -0
- package/types/keywords.d.ts +2 -0
- package/types/markdownBuilder.d.ts +8 -0
- package/types/readmeBuilder.d.ts +5 -0
- package/types/schemaProxy.d.ts +1 -0
- package/types/symbols.d.ts +11 -0
- package/types/traverseSchema.d.ts +6 -0
- package/types/writeMarkdown.d.ts +56 -0
- package/types/writeSchema.d.ts +19 -0
- package/.circleci/config.yml +0 -83
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -23
- package/.github/workflows/semantic-release.yaml +0 -55
- package/.github/workflows/semver-check.yaml +0 -16
- package/.renovaterc.json +0 -3
- package/.tidelift.yml +0 -32
- package/crowdin.yml +0 -4
- package/examples/abstract.md +0 -3
- package/examples/docs/README.md +0 -121
- package/examples/docs/abstract-definitions-first-properties-foo.md +0 -15
- package/examples/docs/abstract-definitions-first-properties-nonfoo.md +0 -23
- package/examples/docs/abstract-definitions-first.md +0 -66
- package/examples/docs/abstract-definitions-second-properties-bar.md +0 -15
- package/examples/docs/abstract-definitions-second.md +0 -39
- package/examples/docs/abstract-definitions.md +0 -15
- package/examples/docs/abstract.md +0 -104
- package/examples/docs/arrays-properties-boollist-items.md +0 -15
- package/examples/docs/arrays-properties-boollist.md +0 -19
- package/examples/docs/arrays-properties-coordinatelist-items-items.md +0 -21
- package/examples/docs/arrays-properties-coordinatelist-items.md +0 -21
- package/examples/docs/arrays-properties-coordinatelist.md +0 -19
- package/examples/docs/arrays-properties-intlist-items.md +0 -15
- package/examples/docs/arrays-properties-intlist.md +0 -21
- package/examples/docs/arrays-properties-jointypelist-items-oneof-0-properties-foo.md +0 -21
- package/examples/docs/arrays-properties-jointypelist-items-oneof-0.md +0 -45
- package/examples/docs/arrays-properties-jointypelist-items-oneof-1-properties-bar.md +0 -21
- package/examples/docs/arrays-properties-jointypelist-items-oneof-1.md +0 -45
- package/examples/docs/arrays-properties-jointypelist-items.md +0 -21
- package/examples/docs/arrays-properties-jointypelist.md +0 -15
- package/examples/docs/arrays-properties-list-items.md +0 -15
- package/examples/docs/arrays-properties-list.md +0 -15
- package/examples/docs/arrays-properties-listlist-items.md +0 -15
- package/examples/docs/arrays-properties-listlist.md +0 -15
- package/examples/docs/arrays-properties-numlist-items.md +0 -19
- package/examples/docs/arrays-properties-numlist.md +0 -19
- package/examples/docs/arrays-properties-objectlist-items-properties-a.md +0 -15
- package/examples/docs/arrays-properties-objectlist-items-properties-b.md +0 -15
- package/examples/docs/arrays-properties-objectlist-items.md +0 -58
- package/examples/docs/arrays-properties-objectlist.md +0 -15
- package/examples/docs/arrays-properties-stringlistlist-items-items.md +0 -15
- package/examples/docs/arrays-properties-stringlistlist-items.md +0 -15
- package/examples/docs/arrays-properties-stringlistlist.md +0 -15
- package/examples/docs/arrays-properties-tuple-items-negative-integer.md +0 -19
- package/examples/docs/arrays-properties-tuple-items-positive-integer.md +0 -19
- package/examples/docs/arrays-properties-tuple-zero.md +0 -23
- package/examples/docs/arrays-properties-tuple.md +0 -21
- package/examples/docs/arrays.md +0 -240
- package/examples/docs/complex-additionalproperties.md +0 -15
- package/examples/docs/complex-patternproperties-int.md +0 -15
- package/examples/docs/complex-patternproperties-str.md +0 -15
- package/examples/docs/complex-patternproperties.md +0 -15
- package/examples/docs/complex-properties-and-allof-0.md +0 -19
- package/examples/docs/complex-properties-and-allof-1.md +0 -19
- package/examples/docs/complex-properties-and.md +0 -21
- package/examples/docs/complex-properties-or-anyof-0.md +0 -15
- package/examples/docs/complex-properties-or-anyof-1.md +0 -19
- package/examples/docs/complex-properties-or.md +0 -21
- package/examples/docs/complex-properties-reflocalfiledef.md +0 -39
- package/examples/docs/complex-properties-refnestedobj-properties-refobj.md +0 -39
- package/examples/docs/complex-properties-refnestedobj.md +0 -39
- package/examples/docs/complex-properties-refobj.md +0 -39
- package/examples/docs/complex-properties-xor-oneof-0.md +0 -19
- package/examples/docs/complex-properties-xor-oneof-1.md +0 -19
- package/examples/docs/complex-properties-xor.md +0 -21
- package/examples/docs/complex.md +0 -285
- package/examples/docs/constants-properties-hello.md +0 -23
- package/examples/docs/constants.md +0 -47
- package/examples/docs/custom-allof-0.md +0 -15
- package/examples/docs/custom-allof-1.md +0 -39
- package/examples/docs/custom-allof-2.md +0 -39
- package/examples/docs/custom-definitions-first-properties-foo.md +0 -15
- package/examples/docs/custom-definitions-first-properties.md +0 -15
- package/examples/docs/custom-definitions-first.md +0 -39
- package/examples/docs/custom-definitions-second-properties-bar.md +0 -15
- package/examples/docs/custom-definitions-second-properties.md +0 -15
- package/examples/docs/custom-definitions-second.md +0 -39
- package/examples/docs/custom-definitions.md +0 -15
- package/examples/docs/custom.md +0 -85
- package/examples/docs/deepextending-allof-0.md +0 -49
- package/examples/docs/deepextending-allof-1.md +0 -89
- package/examples/docs/deepextending-allof-3.md +0 -39
- package/examples/docs/deepextending-definitions-fourth-properties-hey.md +0 -15
- package/examples/docs/deepextending-definitions-fourth-properties.md +0 -15
- package/examples/docs/deepextending-definitions-fourth.md +0 -39
- package/examples/docs/deepextending-definitions.md +0 -15
- package/examples/docs/deepextending.md +0 -57
- package/examples/docs/definitions-definitions-myid-properties-id-1.md +0 -19
- package/examples/docs/definitions-definitions-myid-properties-id.md +0 -19
- package/examples/docs/definitions-definitions-myid-properties-metaid.md +0 -19
- package/examples/docs/definitions-definitions-myid-properties.md +0 -15
- package/examples/docs/definitions-definitions-myid.md +0 -89
- package/examples/docs/definitions-definitions.md +0 -15
- package/examples/docs/definitions.md +0 -117
- package/examples/docs/enums-properties-enumerated-nested-properties-test.md +0 -25
- package/examples/docs/enums-properties-enumerated-nested.md +0 -49
- package/examples/docs/enums-properties-hello.md +0 -24
- package/examples/docs/enums.md +0 -67
- package/examples/docs/example-properties-bar.md +0 -25
- package/examples/docs/example-properties-foo.md +0 -21
- package/examples/docs/example.md +0 -83
- package/examples/docs/examples-properties-bar.md +0 -25
- package/examples/docs/examples-properties-foo.md +0 -21
- package/examples/docs/examples.md +0 -90
- package/examples/docs/extending-definitions-third-properties-baaaz.md +0 -21
- package/examples/docs/extending-definitions-third.md +0 -45
- package/examples/docs/extending-definitions.md +0 -15
- package/examples/docs/extending.md +0 -61
- package/examples/docs/extensible-definitions-first-properties-foo.md +0 -21
- package/examples/docs/extensible-definitions-first-properties.md +0 -15
- package/examples/docs/extensible-definitions-first.md +0 -45
- package/examples/docs/extensible-definitions-second-properties-bar.md +0 -25
- package/examples/docs/extensible-definitions-second-properties.md +0 -15
- package/examples/docs/extensible-definitions-second.md +0 -49
- package/examples/docs/extensible-definitions.md +0 -15
- package/examples/docs/extensible.md +0 -93
- package/examples/docs/identifiable-properties-id.md +0 -19
- package/examples/docs/identifiable.md +0 -43
- package/examples/docs/join-oneof-0-not-oneof-0-properties-foo.md +0 -21
- package/examples/docs/join-oneof-0-not-oneof-0.md +0 -45
- package/examples/docs/join-oneof-0-not-oneof-1-properties-bar.md +0 -21
- package/examples/docs/join-oneof-0-not-oneof-1.md +0 -45
- package/examples/docs/join-oneof-0-not.md +0 -21
- package/examples/docs/join-oneof-0.md +0 -23
- package/examples/docs/join-oneof-1-allof-0-properties-foo.md +0 -21
- package/examples/docs/join-oneof-1-allof-0.md +0 -45
- package/examples/docs/join-oneof-1.md +0 -19
- package/examples/docs/join-oneof-2-anyof-0-properties-bar.md +0 -21
- package/examples/docs/join-oneof-2-anyof-0.md +0 -45
- package/examples/docs/join-oneof-2.md +0 -19
- package/examples/docs/join.md +0 -33
- package/examples/docs/nestedobj-properties-settings-properties-collaborators-patternproperties-.md +0 -15
- package/examples/docs/nestedobj-properties-settings-properties-collaborators-patternproperties.md +0 -15
- package/examples/docs/nestedobj-properties-settings-properties-collaborators-properties-id.md +0 -15
- package/examples/docs/nestedobj-properties-settings-properties-collaborators.md +0 -58
- package/examples/docs/nestedobj-properties-settings.md +0 -39
- package/examples/docs/nestedobj.md +0 -39
- package/examples/docs/pattern-patternproperties-0-9.md +0 -21
- package/examples/docs/pattern-patternproperties.md +0 -15
- package/examples/docs/pattern.md +0 -45
- package/examples/docs/simple-properties-id.md +0 -19
- package/examples/docs/simple.md +0 -43
- package/examples/docs/simpletypes-properties-integer_threes.md +0 -23
- package/examples/docs/simpletypes-properties-interger_constrained.md +0 -19
- package/examples/docs/simpletypes-properties-interger_unconstrained.md +0 -15
- package/examples/docs/simpletypes-properties-number_constrained.md +0 -19
- package/examples/docs/simpletypes-properties-number_unconstrained.md +0 -15
- package/examples/docs/simpletypes-properties-string_date.md +0 -19
- package/examples/docs/simpletypes-properties-string_email.md +0 -19
- package/examples/docs/simpletypes-properties-string_hostname.md +0 -19
- package/examples/docs/simpletypes-properties-string_ipv4.md +0 -19
- package/examples/docs/simpletypes-properties-string_ipv6.md +0 -19
- package/examples/docs/simpletypes-properties-string_length.md +0 -31
- package/examples/docs/simpletypes-properties-string_pattern-metaenum.md +0 -15
- package/examples/docs/simpletypes-properties-string_pattern.md +0 -39
- package/examples/docs/simpletypes-properties-string_pattern_noexample.md +0 -25
- package/examples/docs/simpletypes-properties-string_pattern_singleexample.md +0 -31
- package/examples/docs/simpletypes-properties-string_unconstrained.md +0 -21
- package/examples/docs/simpletypes-properties-string_uri.md +0 -19
- package/examples/docs/simpletypes-properties-yesno.md +0 -15
- package/examples/docs/simpletypes.md +0 -455
- package/examples/docs/stabilizing-properties-id.md +0 -19
- package/examples/docs/stabilizing.md +0 -43
- package/examples/docs/subdir-allof-0.md +0 -43
- package/examples/docs/subdir-definitions-content-properties-id.md +0 -19
- package/examples/docs/subdir-definitions-content-properties.md +0 -15
- package/examples/docs/subdir-definitions-content.md +0 -43
- package/examples/docs/subdir-definitions.md +0 -15
- package/examples/docs/subdir.md +0 -55
- package/examples/docs/typearrays-properties-null.md +0 -15
- package/examples/docs/typearrays-properties-string-or-null.md +0 -15
- package/examples/docs/typearrays-properties-string-or-number-null.md +0 -15
- package/examples/docs/typearrays-properties-string-or-number.md +0 -15
- package/examples/docs/typearrays.md +0 -96
- package/examples/docsWithoutHeader/arrays.schema.md +0 -254
- package/examples/generated-schemas/abstract.schema.json +0 -1
- package/examples/generated-schemas/arrays.schema.json +0 -1
- package/examples/generated-schemas/complex.schema.json +0 -1
- package/examples/generated-schemas/constants.schema.json +0 -1
- package/examples/generated-schemas/custom.schema.json +0 -1
- package/examples/generated-schemas/deepextending.schema.json +0 -1
- package/examples/generated-schemas/definitions.schema.json +0 -1
- package/examples/generated-schemas/enums.schema.json +0 -1
- package/examples/generated-schemas/example.schema.json +0 -1
- package/examples/generated-schemas/examples.schema.json +0 -1
- package/examples/generated-schemas/extending.schema.json +0 -1
- package/examples/generated-schemas/extensible.schema.json +0 -1
- package/examples/generated-schemas/identifiable.schema.json +0 -1
- package/examples/generated-schemas/join.schema.json +0 -1
- package/examples/generated-schemas/nestedobj.schema.json +0 -1
- package/examples/generated-schemas/pattern.schema.json +0 -1
- package/examples/generated-schemas/simple.schema.json +0 -1
- package/examples/generated-schemas/simpletypes.schema.json +0 -1
- package/examples/generated-schemas/stabilizing.schema.json +0 -1
- package/examples/generated-schemas/subdir/subdir.schema.json +0 -1
- package/examples/generated-schemas/typearrays.schema.json +0 -1
- package/examples/schemas/abstract.schema.json +0 -44
- package/examples/schemas/arrays.schema.json +0 -185
- package/examples/schemas/complex.schema.json +0 -123
- package/examples/schemas/constants.schema.json +0 -25
- package/examples/schemas/custom.schema.json +0 -41
- package/examples/schemas/deepextending.schema.json +0 -37
- package/examples/schemas/definitions.description.md +0 -17
- package/examples/schemas/definitions.schema.json +0 -46
- package/examples/schemas/enums.schema.json +0 -42
- package/examples/schemas/example.example.1.json +0 -4
- package/examples/schemas/example.schema.json +0 -29
- package/examples/schemas/examples.example.1.json +0 -4
- package/examples/schemas/examples.example.2.json +0 -4
- package/examples/schemas/examples.schema.json +0 -32
- package/examples/schemas/extending.schema.json +0 -38
- package/examples/schemas/extensible.schema.json +0 -38
- package/examples/schemas/identifiable.schema.json +0 -22
- package/examples/schemas/join.schema.json +0 -88
- package/examples/schemas/nestedobj.schema.json +0 -35
- package/examples/schemas/pattern.schema.json +0 -21
- package/examples/schemas/simple.schema.json +0 -22
- package/examples/schemas/simpletypes.schema.json +0 -151
- package/examples/schemas/stabilizing.schema.json +0 -23
- package/examples/schemas/subdir/subdir.schema.json +0 -29
- package/examples/schemas/typearrays.schema.json +0 -39
- package/examples/status.md +0 -3
- package/test/api.test.js +0 -55
- package/test/cyclicSchemaIntegration.test.js +0 -87
- package/test/fixtures/additionalprops/additionalprops.schema.json +0 -6
- package/test/fixtures/additionalprops/arrays.schema.json +0 -9
- package/test/fixtures/arrays/arrays.schema.json +0 -201
- package/test/fixtures/arrays/tuple.schema.json +0 -35
- package/test/fixtures/content/html.schema.json +0 -5
- package/test/fixtures/content/jwt.schema.json +0 -26
- package/test/fixtures/content/png.schema.json +0 -6
- package/test/fixtures/cyclic/one.description.md +0 -1
- package/test/fixtures/cyclic/one.example.1.json +0 -1
- package/test/fixtures/cyclic/one.schema.json +0 -17
- package/test/fixtures/cyclic/three.schema.json +0 -17
- package/test/fixtures/cyclic/two.schema.json +0 -17
- package/test/fixtures/deadref/deadref.schema.json +0 -6
- package/test/fixtures/enums/arrayenums.schema.json +0 -29
- package/test/fixtures/enums/enums.schema.json +0 -29
- package/test/fixtures/example/example.schema.json +0 -52
- package/test/fixtures/format/format.schema.json +0 -25
- package/test/fixtures/identifiable/identifiable.schema.json +0 -22
- package/test/fixtures/not/not.schema.json +0 -7
- package/test/fixtures/null/null.schema.json +0 -14
- package/test/fixtures/nullable/array.schema.json +0 -17
- package/test/fixtures/readme-1/abstract.schema.json +0 -50
- package/test/fixtures/readme-1/complex.schema.json +0 -118
- package/test/fixtures/readme-1/simple.schema.json +0 -30
- package/test/fixtures/skipproperties/complete.schema.json +0 -29
- package/test/fixtures/stringformats/simpletypes.schema.json +0 -211
- package/test/fixtures/title/meta.schema.json +0 -53
- package/test/fixtures/type/button.schema.json +0 -28
- package/test/fixtures/type/type.schema.json +0 -20
- package/test/fixtures/types/merged.schema.json +0 -10
- package/test/fixtures/types/object.schema.json +0 -3
- package/test/fixtures/types/objectorarray.schema.json +0 -3
- package/test/fixtures/types/undefined.schema.json +0 -3
- package/test/fixtures/types/wrong.schema.json +0 -6
- package/test/formatting.test.js +0 -59
- package/test/markdownBuilder.test.js +0 -441
- package/test/readmeBuilder.test.js +0 -106
- package/test/schemaProxy.test.js +0 -187
- package/test/testUtils.js +0 -88
- package/test/testintegration.test.js +0 -65
- package/test/traverseSchema.test.js +0 -111
- package/test/zSchemaCoverage.test.js +0 -186
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"meta:license": [
|
|
3
|
-
"Copyright 2017 Adobe Systems Incorporated. All rights reserved.",
|
|
4
|
-
"This file is licensed to you under the Apache License, Version 2.0 (the 'License');",
|
|
5
|
-
"you may not use this file except in compliance with the License. You may obtain a copy",
|
|
6
|
-
"of the License at http://www.apache.org/licenses/LICENSE-2.0"
|
|
7
|
-
],
|
|
8
|
-
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
9
|
-
"$id": "https://example.com/schemas/extending",
|
|
10
|
-
"title": "Extending",
|
|
11
|
-
"description": "This is an extending schema. It pulls `definitions` from other schemas.",
|
|
12
|
-
"type": "object",
|
|
13
|
-
"meta:extensible": true,
|
|
14
|
-
"meta:extends": [
|
|
15
|
-
"https://example.com/schemas/definitions",
|
|
16
|
-
"https://example.com/schemas/extensible"
|
|
17
|
-
],
|
|
18
|
-
"definitions": {
|
|
19
|
-
"third": {
|
|
20
|
-
"type": "object",
|
|
21
|
-
"properties": {
|
|
22
|
-
"baz": {
|
|
23
|
-
"type": "string",
|
|
24
|
-
"title": "BAAAZ!",
|
|
25
|
-
"examples": ["I'm just a humble example"],
|
|
26
|
-
"description": "This property has a unique name to demonstrate it's uniqueness.",
|
|
27
|
-
"version": "1.0.0",
|
|
28
|
-
"testProperty": "test"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"allOf": [
|
|
34
|
-
{ "$ref": "https://example.com/schemas/extensible#/definitions/second"},
|
|
35
|
-
{ "$ref": "https://example.com/schemas/definitions#/definitions/myid" },
|
|
36
|
-
{ "$ref": "#/definitions/third" }
|
|
37
|
-
]
|
|
38
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"meta:license": [
|
|
3
|
-
"Copyright 2017 Adobe Systems Incorporated. All rights reserved.",
|
|
4
|
-
"This file is licensed to you under the Apache License, Version 2.0 (the 'License');",
|
|
5
|
-
"you may not use this file except in compliance with the License. You may obtain a copy",
|
|
6
|
-
"of the License at http://www.apache.org/licenses/LICENSE-2.0"
|
|
7
|
-
],
|
|
8
|
-
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
9
|
-
"$id": "https://example.com/schemas/extensible",
|
|
10
|
-
"title": "Extensible",
|
|
11
|
-
"description": "This is an extensible schema. It has `definitions`, that can be used in other schemas",
|
|
12
|
-
"type": "object",
|
|
13
|
-
"meta:extensible": true,
|
|
14
|
-
"definitions": {
|
|
15
|
-
"first": {
|
|
16
|
-
"properties": {
|
|
17
|
-
"foo": {
|
|
18
|
-
"type": "string",
|
|
19
|
-
"examples": ["bar"],
|
|
20
|
-
"description": "A unique identifier given to every addressable thing.",
|
|
21
|
-
"version": "1.0.0",
|
|
22
|
-
"testProperty": "test"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"second": {
|
|
27
|
-
"properties": {
|
|
28
|
-
"bar": {
|
|
29
|
-
"type": "string",
|
|
30
|
-
"examples": [ "whoo", "hoo"],
|
|
31
|
-
"description": "A horse walks into it.",
|
|
32
|
-
"version": "1.0.0",
|
|
33
|
-
"testProperty": "test"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"meta:license": [
|
|
3
|
-
"Copyright 2017 Adobe Systems Incorporated. All rights reserved.",
|
|
4
|
-
"This file is licensed to you under the Apache License, Version 2.0 (the 'License');",
|
|
5
|
-
"you may not use this file except in compliance with the License. You may obtain a copy",
|
|
6
|
-
"of the License at http://www.apache.org/licenses/LICENSE-2.0"
|
|
7
|
-
],
|
|
8
|
-
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
9
|
-
"$id": "https://example.com/schemas/identifiable",
|
|
10
|
-
"title": "Identifiable",
|
|
11
|
-
"description": "This is a *very* simple example of a JSON schema. There is only one property.",
|
|
12
|
-
"type": "object",
|
|
13
|
-
"properties": {
|
|
14
|
-
"@id": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"format": "uri",
|
|
17
|
-
"description": "A unique identifier given to every addressable thing.",
|
|
18
|
-
"version": "1.0.0",
|
|
19
|
-
"testProperty": "test"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"meta:license": [
|
|
3
|
-
"Copyright 2017 Adobe Systems Incorporated. All rights reserved.",
|
|
4
|
-
"This file is licensed to you under the Apache License, Version 2.0 (the 'License');",
|
|
5
|
-
"you may not use this file except in compliance with the License. You may obtain a copy",
|
|
6
|
-
"of the License at http://www.apache.org/licenses/LICENSE-2.0"
|
|
7
|
-
],
|
|
8
|
-
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
9
|
-
"$id": "https://example.com/schemas/join",
|
|
10
|
-
"title": "Join Types",
|
|
11
|
-
"description": "This is an example of a JSON schema with only a join type key. Here a 'oneOf'.",
|
|
12
|
-
"oneOf": [
|
|
13
|
-
{
|
|
14
|
-
"not": {
|
|
15
|
-
"oneOf": [
|
|
16
|
-
{
|
|
17
|
-
"type": "object",
|
|
18
|
-
"description": "A simple string.",
|
|
19
|
-
"properties": {
|
|
20
|
-
"foo": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"description": "A simple string.",
|
|
23
|
-
"examples": [
|
|
24
|
-
"hello"
|
|
25
|
-
],
|
|
26
|
-
"version": "1.0.0",
|
|
27
|
-
"testProperty": "test"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"type": "object",
|
|
33
|
-
"description": "Another simple string.",
|
|
34
|
-
"properties": {
|
|
35
|
-
"bar": {
|
|
36
|
-
"type": "string",
|
|
37
|
-
"description": "A simple string.",
|
|
38
|
-
"examples": [
|
|
39
|
-
"world"
|
|
40
|
-
],
|
|
41
|
-
"version": "1.0.0",
|
|
42
|
-
"testProperty": "test"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"allOf": [
|
|
51
|
-
{
|
|
52
|
-
"type": "object",
|
|
53
|
-
"description": "A simple string.",
|
|
54
|
-
"properties": {
|
|
55
|
-
"foo": {
|
|
56
|
-
"type": "string",
|
|
57
|
-
"description": "A simple string.",
|
|
58
|
-
"examples": [
|
|
59
|
-
"hello"
|
|
60
|
-
],
|
|
61
|
-
"version": "1.0.0",
|
|
62
|
-
"testProperty": "test"
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"anyOf": [
|
|
70
|
-
{
|
|
71
|
-
"type": "object",
|
|
72
|
-
"description": "Another simple string.",
|
|
73
|
-
"properties": {
|
|
74
|
-
"bar": {
|
|
75
|
-
"type": "string",
|
|
76
|
-
"description": "A simple string.",
|
|
77
|
-
"examples": [
|
|
78
|
-
"world"
|
|
79
|
-
],
|
|
80
|
-
"version": "1.0.0",
|
|
81
|
-
"testProperty": "test"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$id": "https://example.com/schemas/nestedobject",
|
|
3
|
-
"$schema": "http://json-schema.org/draft-07/schema",
|
|
4
|
-
"title": "Nested Object",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"settings": {
|
|
8
|
-
"description": "settings",
|
|
9
|
-
"type": "object",
|
|
10
|
-
"properties": {
|
|
11
|
-
"collaborators": {
|
|
12
|
-
"description": "collaborators",
|
|
13
|
-
"type": "object",
|
|
14
|
-
"patternProperties": {
|
|
15
|
-
".*": {
|
|
16
|
-
"type": "string"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"properties": {
|
|
20
|
-
"id": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"version": "1.0.0",
|
|
23
|
-
"testProperty": "test"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"version": "1.0.0",
|
|
27
|
-
"testProperty": "test"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"version": "1.0.0",
|
|
31
|
-
"testProperty": "test"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"additionalProperties": false
|
|
35
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"meta:license": [
|
|
3
|
-
"Copyright 2017 Adobe Systems Incorporated. All rights reserved.",
|
|
4
|
-
"This file is licensed to you under the Apache License, Version 2.0 (the 'License');",
|
|
5
|
-
"you may not use this file except in compliance with the License. You may obtain a copy",
|
|
6
|
-
"of the License at http://www.apache.org/licenses/LICENSE-2.0"
|
|
7
|
-
],
|
|
8
|
-
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
9
|
-
"$id": "https://example.com/schemas/pattern",
|
|
10
|
-
"title": "Pattern Properties",
|
|
11
|
-
"description": "This is an example of a JSON schema with only a `patternProperties` key.",
|
|
12
|
-
"patternProperties": {
|
|
13
|
-
"[0-9]": {
|
|
14
|
-
"type": "string",
|
|
15
|
-
"description": "A simple string.",
|
|
16
|
-
"examples": ["bar"],
|
|
17
|
-
"version": "1.0.0",
|
|
18
|
-
"testProperty": "test"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"meta:license": [
|
|
3
|
-
"Copyright 2017 Adobe Systems Incorporated. All rights reserved.",
|
|
4
|
-
"This file is licensed to you under the Apache License, Version 2.0 (the 'License');",
|
|
5
|
-
"you may not use this file except in compliance with the License. You may obtain a copy",
|
|
6
|
-
"of the License at http://www.apache.org/licenses/LICENSE-2.0"
|
|
7
|
-
],
|
|
8
|
-
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
9
|
-
"$id": "https://example.com/schemas/simple",
|
|
10
|
-
"title": "Simple",
|
|
11
|
-
"description": "This is a *very* simple example of a JSON schema. There is only one property.",
|
|
12
|
-
"type": "object",
|
|
13
|
-
"properties": {
|
|
14
|
-
"id": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"format": "uri",
|
|
17
|
-
"description": "A unique identifier given to every addressable thing.",
|
|
18
|
-
"version": "1.0.0",
|
|
19
|
-
"testProperty": "test"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"meta:license": [
|
|
3
|
-
"Copyright 2017 Adobe Systems Incorporated. All rights reserved.",
|
|
4
|
-
"This file is licensed to you under the Apache License, Version 2.0 (the 'License');",
|
|
5
|
-
"you may not use this file except in compliance with the License. You may obtain a copy",
|
|
6
|
-
"of the License at http://www.apache.org/licenses/LICENSE-2.0"
|
|
7
|
-
],
|
|
8
|
-
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
9
|
-
"$id": "https://example.com/schemas/simpletypes",
|
|
10
|
-
"title": "Simple Types",
|
|
11
|
-
"type": "object",
|
|
12
|
-
"description": "This is an example schema with examples for multiple types and their constraints.",
|
|
13
|
-
"properties": {
|
|
14
|
-
"string_unconstrained": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "A simple string, without any constraints.",
|
|
17
|
-
"examples": ["bar"],
|
|
18
|
-
"version": "1.0.0",
|
|
19
|
-
"testProperty": "test"
|
|
20
|
-
},
|
|
21
|
-
"string_length": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"description": "A string with minumum and maximum length",
|
|
24
|
-
"examples": ["bar", "baz"],
|
|
25
|
-
"minLength": 3,
|
|
26
|
-
"maxLength": 3,
|
|
27
|
-
"version": "1.0.0",
|
|
28
|
-
"testProperty": "test"
|
|
29
|
-
},
|
|
30
|
-
"string_pattern": {
|
|
31
|
-
"type": "string",
|
|
32
|
-
"description": "A string following a regular expression",
|
|
33
|
-
"pattern": "^ba.$",
|
|
34
|
-
"examples": ["bar", "baz", "bat"],
|
|
35
|
-
"meta:enum": {
|
|
36
|
-
"baa": "the sounds of sheeps",
|
|
37
|
-
"bad": "German bathroom",
|
|
38
|
-
"bag": "holding device",
|
|
39
|
-
"bah": "humbug!",
|
|
40
|
-
"bam": "a loud sound",
|
|
41
|
-
"ban": "don't do this",
|
|
42
|
-
"bap": "a British soft bread roll",
|
|
43
|
-
"bas": "from ancient Egyptian religion, an aspect of the soul",
|
|
44
|
-
"bat": "…out of hell",
|
|
45
|
-
"bay": ", sitting by the dock of the"
|
|
46
|
-
},
|
|
47
|
-
"version": "1.0.0",
|
|
48
|
-
"testProperty": "test"
|
|
49
|
-
},
|
|
50
|
-
"string_pattern_noexample": {
|
|
51
|
-
"type": "string",
|
|
52
|
-
"description": "A string following a regular expression",
|
|
53
|
-
"pattern": "^ba.$",
|
|
54
|
-
"version": "1.0.0",
|
|
55
|
-
"testProperty": "test"
|
|
56
|
-
},
|
|
57
|
-
"string_pattern_singleexample": {
|
|
58
|
-
"type": "string",
|
|
59
|
-
"description": "A string following a regular expression",
|
|
60
|
-
"pattern": "^ba.$",
|
|
61
|
-
"examples": ["bar"],
|
|
62
|
-
"version": "1.0.0",
|
|
63
|
-
"testProperty": "test"
|
|
64
|
-
},
|
|
65
|
-
"string_date": {
|
|
66
|
-
"type": "string",
|
|
67
|
-
"description": "A date-like string.",
|
|
68
|
-
"format": "date-time",
|
|
69
|
-
"version": "1.0.0",
|
|
70
|
-
"testProperty": "test"
|
|
71
|
-
},
|
|
72
|
-
"string_email": {
|
|
73
|
-
"type": "string",
|
|
74
|
-
"description": "An email-like string.",
|
|
75
|
-
"format": "email",
|
|
76
|
-
"version": "1.0.0",
|
|
77
|
-
"testProperty": "test"
|
|
78
|
-
},
|
|
79
|
-
"string_hostname": {
|
|
80
|
-
"type": "string",
|
|
81
|
-
"description": "A hostname-like string.",
|
|
82
|
-
"format": "hostname",
|
|
83
|
-
"version": "1.0.0",
|
|
84
|
-
"testProperty": "test"
|
|
85
|
-
},
|
|
86
|
-
"string_ipv4": {
|
|
87
|
-
"type": "string",
|
|
88
|
-
"description": "An IPv4-like string.",
|
|
89
|
-
"format": "ipv4",
|
|
90
|
-
"version": "1.0.0",
|
|
91
|
-
"testProperty": "test"
|
|
92
|
-
},
|
|
93
|
-
"string_ipv6": {
|
|
94
|
-
"type": "string",
|
|
95
|
-
"description": "An IPv6-like string.",
|
|
96
|
-
"format": "ipv6",
|
|
97
|
-
"version": "1.0.0",
|
|
98
|
-
"testProperty": "test"
|
|
99
|
-
},
|
|
100
|
-
"string_uri": {
|
|
101
|
-
"type": "string",
|
|
102
|
-
"description": "A URI.",
|
|
103
|
-
"format": "uri",
|
|
104
|
-
"version": "1.0.0",
|
|
105
|
-
"testProperty": "test"
|
|
106
|
-
},
|
|
107
|
-
"number_unconstrained": {
|
|
108
|
-
"type": "number",
|
|
109
|
-
"description": "Just a number",
|
|
110
|
-
"version": "1.0.0",
|
|
111
|
-
"testProperty": "test"
|
|
112
|
-
},
|
|
113
|
-
"interger_unconstrained": {
|
|
114
|
-
"type": "integer",
|
|
115
|
-
"description": "Just a whole number. I don't like fractions.",
|
|
116
|
-
"version": "1.0.0",
|
|
117
|
-
"testProperty": "test"
|
|
118
|
-
},
|
|
119
|
-
"interger_constrained": {
|
|
120
|
-
"type": "integer",
|
|
121
|
-
"description": "Just a whole number. I don't like fractions. Don't get too small",
|
|
122
|
-
"minimum": 10,
|
|
123
|
-
"version": "1.0.0",
|
|
124
|
-
"testProperty": "test"
|
|
125
|
-
},
|
|
126
|
-
"number_constrained": {
|
|
127
|
-
"type": "number",
|
|
128
|
-
"description": "Just a number. Don't get too big.",
|
|
129
|
-
"exclusiveMaximum": 10,
|
|
130
|
-
"version": "1.0.0",
|
|
131
|
-
"testProperty": "test"
|
|
132
|
-
},
|
|
133
|
-
"integer_threes": {
|
|
134
|
-
"type":"integer",
|
|
135
|
-
"description": "Guess what number is valid",
|
|
136
|
-
"multipleOf": 3,
|
|
137
|
-
"minimum": 2,
|
|
138
|
-
"maximum": 4,
|
|
139
|
-
"version": "1.0.0",
|
|
140
|
-
"testProperty": "test"
|
|
141
|
-
},
|
|
142
|
-
"yesno": {
|
|
143
|
-
"type": "boolean",
|
|
144
|
-
"version": "1.0.0",
|
|
145
|
-
"testProperty": "test"
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
"required": [
|
|
149
|
-
"yesno"
|
|
150
|
-
]
|
|
151
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"meta:license": [
|
|
3
|
-
"Copyright 2017 Adobe Systems Incorporated. All rights reserved.",
|
|
4
|
-
"This file is licensed to you under the Apache License, Version 2.0 (the 'License');",
|
|
5
|
-
"you may not use this file except in compliance with the License. You may obtain a copy",
|
|
6
|
-
"of the License at http://www.apache.org/licenses/LICENSE-2.0"
|
|
7
|
-
],
|
|
8
|
-
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
9
|
-
"$id": "https://example.com/schemas/stabilizing",
|
|
10
|
-
"title": "Stabilizing",
|
|
11
|
-
"description": "This is a schema which is currently in the `stabilizing` status.",
|
|
12
|
-
"meta:status": "stabilizing",
|
|
13
|
-
"type": "object",
|
|
14
|
-
"properties": {
|
|
15
|
-
"id": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"format": "uri",
|
|
18
|
-
"description": "A unique identifier given to every addressable thing.",
|
|
19
|
-
"version": "1.0.0",
|
|
20
|
-
"testProperty": "test"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"meta:license": [
|
|
3
|
-
"Copyright 2017 Adobe Systems Incorporated. All rights reserved.",
|
|
4
|
-
"This file is licensed to you under the Apache License, Version 2.0 (the 'License');",
|
|
5
|
-
"you may not use this file except in compliance with the License. You may obtain a copy",
|
|
6
|
-
"of the License at http://www.apache.org/licenses/LICENSE-2.0"
|
|
7
|
-
],
|
|
8
|
-
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
9
|
-
"$id": "https://example.com/schemas/subdir/subdir",
|
|
10
|
-
"title": "Subdir",
|
|
11
|
-
"type": "object",
|
|
12
|
-
"description": "A schema in a sub directory",
|
|
13
|
-
"definitions": {
|
|
14
|
-
"content": {
|
|
15
|
-
"properties": {
|
|
16
|
-
"id": {
|
|
17
|
-
"type": "string",
|
|
18
|
-
"format": "uri",
|
|
19
|
-
"description": "A unique identifier given to every addressable thing.",
|
|
20
|
-
"version": "1.0.0",
|
|
21
|
-
"testProperty": "test"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"allOf": [
|
|
27
|
-
{"$ref": "#/definitions/content"}
|
|
28
|
-
]
|
|
29
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"meta:license": [
|
|
3
|
-
"Copyright 2017 Adobe Systems Incorporated. All rights reserved.",
|
|
4
|
-
"This file is licensed to you under the Apache License, Version 2.0 (the 'License');",
|
|
5
|
-
"you may not use this file except in compliance with the License. You may obtain a copy",
|
|
6
|
-
"of the License at http://www.apache.org/licenses/LICENSE-2.0"
|
|
7
|
-
],
|
|
8
|
-
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
9
|
-
"$id": "https://example.com/schemas/typearrays",
|
|
10
|
-
"title": "Type Arrays",
|
|
11
|
-
"description": "This schema test type arrays and nullable types",
|
|
12
|
-
"type": "object",
|
|
13
|
-
"properties": {
|
|
14
|
-
"null": {
|
|
15
|
-
"type": "null",
|
|
16
|
-
"description": "This is just nothing",
|
|
17
|
-
"version": "1.0.0",
|
|
18
|
-
"testProperty": "test"
|
|
19
|
-
},
|
|
20
|
-
"string-or-null": {
|
|
21
|
-
"type": ["string", "null"],
|
|
22
|
-
"description": "Nullable string",
|
|
23
|
-
"version": "1.0.0",
|
|
24
|
-
"testProperty": "test"
|
|
25
|
-
},
|
|
26
|
-
"string-or-number": {
|
|
27
|
-
"type": ["string", "number"],
|
|
28
|
-
"description": "Types can be many things",
|
|
29
|
-
"version": "1.0.0",
|
|
30
|
-
"testProperty": "test"
|
|
31
|
-
},
|
|
32
|
-
"string-or-number-null": {
|
|
33
|
-
"type": ["string", "number", "null"],
|
|
34
|
-
"description": "Types can be many things, even nothing at all.",
|
|
35
|
-
"version": "1.0.0",
|
|
36
|
-
"testProperty": "test"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
package/examples/status.md
DELETED
package/test/api.test.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2021 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
/* eslint-env mocha */
|
|
13
|
-
/* eslint-disable no-unused-expressions */
|
|
14
|
-
const assert = require('assert');
|
|
15
|
-
const fs = require('fs-extra');
|
|
16
|
-
const path = require('path');
|
|
17
|
-
const { loadschemas } = require('./testUtils');
|
|
18
|
-
|
|
19
|
-
const example = require('./fixtures/example/example.schema.json');
|
|
20
|
-
const { jsonschema2md } = require('../lib/index');
|
|
21
|
-
|
|
22
|
-
describe('Testing Main API', () => {
|
|
23
|
-
beforeEach(async () => {
|
|
24
|
-
await fs.remove(path.resolve(__dirname, '..', 'tmp'));
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
afterEach(async () => {
|
|
28
|
-
await fs.remove(path.resolve(__dirname, '..', 'tmp'));
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('Main API processes readme-1 directory', async () => {
|
|
32
|
-
const schemas = await loadschemas('readme-1');
|
|
33
|
-
const res = jsonschema2md(schemas, {
|
|
34
|
-
schemaPath: path.resolve(__dirname, 'fixtures/readme-1'),
|
|
35
|
-
out: 'tmp',
|
|
36
|
-
schemaOut: 'tmp',
|
|
37
|
-
includeReadme: true,
|
|
38
|
-
});
|
|
39
|
-
// console.log('done!', res);
|
|
40
|
-
assert(res === Object(res));
|
|
41
|
-
const readme = await fs.stat(path.resolve(__dirname, '..', 'tmp', 'README.md'));
|
|
42
|
-
assert.ok(readme.isFile());
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('Main API processes example schema', async () => {
|
|
46
|
-
const res = jsonschema2md(example, {
|
|
47
|
-
out: 'tmp',
|
|
48
|
-
includeReadme: true,
|
|
49
|
-
});
|
|
50
|
-
// console.log('done!', res);
|
|
51
|
-
assert(res === Object(res));
|
|
52
|
-
const readme = await fs.stat(path.resolve(__dirname, '..', 'tmp', 'README.md'));
|
|
53
|
-
assert.ok(readme.isFile());
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2019 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
/* eslint-env mocha */
|
|
13
|
-
|
|
14
|
-
const path = require('path');
|
|
15
|
-
const fs = require('fs-extra');
|
|
16
|
-
const assert = require('assert');
|
|
17
|
-
const { loader } = require('../lib/schemaProxy');
|
|
18
|
-
const { assertMarkdown } = require('./testUtils');
|
|
19
|
-
const readme = require('../lib/readmeBuilder');
|
|
20
|
-
const markdown = require('../lib/markdownBuilder');
|
|
21
|
-
const traverse = require('../lib/traverseSchema');
|
|
22
|
-
const { writeSchema } = require('../lib/writeSchema');
|
|
23
|
-
|
|
24
|
-
describe('Integration Test: Cyclic References', () => {
|
|
25
|
-
let one;
|
|
26
|
-
let two;
|
|
27
|
-
let three;
|
|
28
|
-
|
|
29
|
-
let proxiedone;
|
|
30
|
-
let proxiedtwo;
|
|
31
|
-
let proxiedthree;
|
|
32
|
-
|
|
33
|
-
let allschemas;
|
|
34
|
-
|
|
35
|
-
beforeEach('Read Schemas from disk', async () => {
|
|
36
|
-
console.log('Reading Schemas');
|
|
37
|
-
one = await fs.readJson(path.resolve(__dirname, 'fixtures', 'cyclic', 'one.schema.json'));
|
|
38
|
-
two = await fs.readJson(path.resolve(__dirname, 'fixtures', 'cyclic', 'two.schema.json'));
|
|
39
|
-
three = await fs.readJson(path.resolve(__dirname, 'fixtures', 'cyclic', 'three.schema.json'));
|
|
40
|
-
|
|
41
|
-
const myloader = loader();
|
|
42
|
-
|
|
43
|
-
console.log('Loading Schemas');
|
|
44
|
-
proxiedone = myloader(one, path.resolve(__dirname, 'fixtures', 'cyclic', 'one.schema.json'));
|
|
45
|
-
proxiedtwo = myloader(two, path.resolve(__dirname, 'fixtures', 'cyclic', 'two.schema.json'));
|
|
46
|
-
proxiedthree = myloader(three, path.resolve(__dirname, 'fixtures', 'cyclic', 'three.schema.json'));
|
|
47
|
-
|
|
48
|
-
console.log('Traversing Schemas');
|
|
49
|
-
|
|
50
|
-
allschemas = traverse([proxiedone, proxiedtwo, proxiedthree]);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('Schemas with cyclic references generate README', () => {
|
|
54
|
-
const builder = readme({ readme: true });
|
|
55
|
-
const result = builder([proxiedone, proxiedtwo, proxiedthree]);
|
|
56
|
-
|
|
57
|
-
assertMarkdown(result)
|
|
58
|
-
.contains('http://example.com/schemas/one')
|
|
59
|
-
.contains('http://example.com/schemas/two')
|
|
60
|
-
.contains('http://example.com/schemas/three')
|
|
61
|
-
.contains('http://json-schema.org/draft-04/schema#');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('Schemas with cyclic references generate Markdown', () => {
|
|
65
|
-
const builder = markdown();
|
|
66
|
-
const documents = builder(allschemas);
|
|
67
|
-
assertMarkdown(documents['one-properties-children-items'])
|
|
68
|
-
.contains('any of');
|
|
69
|
-
|
|
70
|
-
assertMarkdown(documents.one)
|
|
71
|
-
.contains('one-properties-children-items');
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('Schemas with cyclic references get written to disk', () => {
|
|
75
|
-
const writer = writeSchema({ origindir: path.resolve(__dirname, 'fixtures', 'cyclic'), schemadir: path.resolve(__dirname, 'fixtures', 'cyclic-out') });
|
|
76
|
-
writer(allschemas);
|
|
77
|
-
const schemaone = fs.readJsonSync(path.resolve(__dirname, 'fixtures', 'cyclic-out', 'one.schema.json'));
|
|
78
|
-
assert.deepStrictEqual(schemaone, {
|
|
79
|
-
$schema: 'http://json-schema.org/draft-04/schema#',
|
|
80
|
-
$id: 'http://example.com/schemas/one',
|
|
81
|
-
type: 'object',
|
|
82
|
-
description: 'The first schema in the cycle (or is it the last?)',
|
|
83
|
-
examples: [{}],
|
|
84
|
-
properties: { children: { type: 'array', items: { anyOf: [{ $ref: 'http://example.com/schemas/three' }, { $ref: 'http://example.com/schemas/two' }] } } },
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
});
|