@adobe/jsonschema2md 7.1.1 → 7.1.3
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/CHANGELOG.md +14 -0
- package/lib/markdownBuilder.js +12 -12
- package/lib/schemaProxy.js +21 -10
- package/package.json +16 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [7.1.3](https://github.com/adobe/jsonschema2md/compare/v7.1.2...v7.1.3) (2022-11-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **markdown-builder:** guard against `enum` being not an array ([aa46ac4](https://github.com/adobe/jsonschema2md/commit/aa46ac4b4ed5d2c1641bec41b78ec04e1f83944b)), closes [#458](https://github.com/adobe/jsonschema2md/issues/458)
|
|
7
|
+
|
|
8
|
+
## [7.1.2](https://github.com/adobe/jsonschema2md/compare/v7.1.1...v7.1.2) (2022-10-06)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **schemaproxy.js:** reuse previously proxied subschemas to fix max call stack size exceeded error ([1388449](https://github.com/adobe/jsonschema2md/commit/13884491df4c9ecc694f3881e40c1861f7acfdf8)), closes [/github.com/adobe/jsonschema2md/issues/252#issuecomment-806067867](https://github.com//github.com/adobe/jsonschema2md/issues/252/issues/issuecomment-806067867) [#252](https://github.com/adobe/jsonschema2md/issues/252)
|
|
14
|
+
|
|
1
15
|
## [7.1.1](https://github.com/adobe/jsonschema2md/compare/v7.1.0...v7.1.1) (2022-05-19)
|
|
2
16
|
|
|
3
17
|
|
package/lib/markdownBuilder.js
CHANGED
|
@@ -278,9 +278,9 @@ export default function build({
|
|
|
278
278
|
(prop) => {
|
|
279
279
|
// this is a linked property
|
|
280
280
|
if (schema[s.meta]
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
281
|
+
&& typeof schema[s.meta][prop.name] === 'object'
|
|
282
|
+
&& schema[s.meta][prop.name].link
|
|
283
|
+
&& schema[s.meta][prop.name].text) {
|
|
284
284
|
return tableCell(link(rewritelinks(schema[s.meta][prop.name].link), i18n`open original schema`, [text(schema[s.meta][prop.name].text)]));
|
|
285
285
|
}
|
|
286
286
|
const value = schema[s.meta] ? schema[s.meta][prop.name] : undefined;
|
|
@@ -398,11 +398,11 @@ export default function build({
|
|
|
398
398
|
return [listItem(paragraph(text(i18n`and all following items may follow any schema`)))];
|
|
399
399
|
} else if (typeof additional === 'object') {
|
|
400
400
|
return [listItem(paragraph([text(i18n`and all following items must follow the schema: `),
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
401
|
+
link(
|
|
402
|
+
`${additional[s.slug]}.md`,
|
|
403
|
+
i18n`check type definition`,
|
|
404
|
+
text(gentitle(additional[s.titles], additional[keyword`type`])),
|
|
405
|
+
)]))];
|
|
406
406
|
}
|
|
407
407
|
return [];
|
|
408
408
|
})(),
|
|
@@ -579,10 +579,10 @@ export default function build({
|
|
|
579
579
|
tableCell(text(i18n`Value`)),
|
|
580
580
|
tableCell(text(i18n`Explanation`)),
|
|
581
581
|
]),
|
|
582
|
-
...schema[keyword`enum`].map((value) => tableRow([
|
|
582
|
+
...(Array.isArray(schema[keyword`enum`]) ? schema[keyword`enum`].map((value) => tableRow([
|
|
583
583
|
tableCell(inlineCode(JSON.stringify(value))),
|
|
584
584
|
tableCell(text(metas[Array.isArray(value) ? JSON.stringify(value) : value] || '')),
|
|
585
|
-
])),
|
|
585
|
+
])) : []),
|
|
586
586
|
]));
|
|
587
587
|
}
|
|
588
588
|
|
|
@@ -664,12 +664,12 @@ export default function build({
|
|
|
664
664
|
if (schema[keyword`minContains`] !== undefined && schema[keyword`contains`]) {
|
|
665
665
|
// console.log('minContains!', schema[s.filename], schema[s.pointer]);
|
|
666
666
|
constraints.push(paragraph([strong(text(i18n`minimum number of contained items`)), text(': '), text(`${i18n`this array may not contain fewer than ${String(schema[keyword`minContains`])} items that validate against the schema:`} `),
|
|
667
|
-
|
|
667
|
+
link(`${schema[keyword`contains`][s.slug]}.md`, i18n`check type definition`, text(gentitle(schema[keyword`contains`][s.titles], schema[keyword`contains`][keyword`type`])))]));
|
|
668
668
|
}
|
|
669
669
|
if (schema[keyword`maxContains`] !== undefined && schema[keyword`contains`]) {
|
|
670
670
|
// console.log('maxContains!', schema[s.filename], schema[s.pointer]);
|
|
671
671
|
constraints.push(paragraph([strong(text(i18n`maximum number of contained items`)), text(': '), text(`${i18n`this array may not contain more than ${String(schema[keyword`maxContains`])} items that validate against the schema:`} `),
|
|
672
|
-
|
|
672
|
+
link(`${schema[keyword`contains`][s.slug]}.md`, i18n`check type definition`, text(gentitle(schema[keyword`contains`][s.titles], schema[keyword`contains`][keyword`type`])))]));
|
|
673
673
|
}
|
|
674
674
|
|
|
675
675
|
// https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.5
|
package/lib/schemaProxy.js
CHANGED
|
@@ -34,7 +34,7 @@ function loadExamples(file, num = 1) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const handler = ({
|
|
37
|
-
root = '', fullpath = null, filename = '.', schemas, parent = null, slugger,
|
|
37
|
+
root = '', fullpath = null, filename = '.', schemas, subschemas, parent = null, slugger,
|
|
38
38
|
}) => {
|
|
39
39
|
const meta = {};
|
|
40
40
|
|
|
@@ -162,14 +162,23 @@ const handler = ({
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
// console.log('making new proxy from', target, prop, 'receiver', receiver[symbols.id]);
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
165
|
+
let subschema;
|
|
166
|
+
if (subschemas.has(retval)) {
|
|
167
|
+
subschema = subschemas.get(retval);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
subschema = new Proxy(retval, handler({
|
|
171
|
+
root: `${root}/${prop}`,
|
|
172
|
+
parent: receiver,
|
|
173
|
+
fullpath,
|
|
174
|
+
filename,
|
|
175
|
+
schemas,
|
|
176
|
+
subschemas,
|
|
177
|
+
slugger,
|
|
178
|
+
}));
|
|
179
|
+
|
|
180
|
+
subschemas.set(retval, subschema);
|
|
181
|
+
}
|
|
173
182
|
|
|
174
183
|
if (subschema[keyword`$id`]) {
|
|
175
184
|
// stow away the schema for lookup
|
|
@@ -190,6 +199,8 @@ export default function loader() {
|
|
|
190
199
|
files: {},
|
|
191
200
|
};
|
|
192
201
|
|
|
202
|
+
const subschemas = new Map();
|
|
203
|
+
|
|
193
204
|
const slugger = new GhSlugger();
|
|
194
205
|
|
|
195
206
|
return (/** @type {string} */ name, /** @type {any} */ schema) => {
|
|
@@ -197,7 +208,7 @@ export default function loader() {
|
|
|
197
208
|
const filename = path.basename(name);
|
|
198
209
|
const fullpath = name === filename ? undefined : name;
|
|
199
210
|
const proxied = new Proxy(schema, handler({
|
|
200
|
-
filename, fullpath, schemas, slugger,
|
|
211
|
+
filename, fullpath, schemas, subschemas, slugger,
|
|
201
212
|
}));
|
|
202
213
|
schemas.loaded.push(proxied);
|
|
203
214
|
if (proxied[keyword`$id`]) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/jsonschema2md",
|
|
3
3
|
"description": "Validate and document complex JSON Schemas the easy way.",
|
|
4
|
-
"version": "7.1.
|
|
4
|
+
"version": "7.1.3",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "types",
|
|
7
7
|
"bin": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"start": "node cli.js",
|
|
17
17
|
"examples": "node cli.js -d examples/schemas/ -o examples/docs/ -x examples/generated-schemas/",
|
|
18
18
|
"test": " c8 --reporter=text --reporter=lcov --check-coverage --branches 80 --statements 95 --lines 95 mocha && node lib/locales/update.js",
|
|
19
|
-
"test-ci": "c8 --reporter=text --reporter=lcov --check-coverage --branches 80 --statements 95 --lines 95 mocha --reporter xunit --reporter-options output=./junit/test-results.xml
|
|
19
|
+
"test-ci": "c8 --reporter=text --reporter=lcov --check-coverage --branches 80 --statements 95 --lines 95 mocha --reporter xunit --reporter-options output=./junit/test-results.xml",
|
|
20
20
|
"emit-types": "npx -p typescript tsc",
|
|
21
21
|
"prepare": "husky install"
|
|
22
22
|
},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"es2015-i18n-tag": "1.6.1",
|
|
28
28
|
"ferrum": "1.9.4",
|
|
29
29
|
"fs-extra": "10.1.0",
|
|
30
|
-
"github-slugger": "
|
|
30
|
+
"github-slugger": "2.0.0",
|
|
31
31
|
"js-yaml": "4.1.0",
|
|
32
32
|
"json-schema": "^0.4.0",
|
|
33
33
|
"mdast-builder": "1.1.1",
|
|
@@ -37,33 +37,32 @@
|
|
|
37
37
|
"remark-parse": "10.0.1",
|
|
38
38
|
"remark-stringify": "10.0.2",
|
|
39
39
|
"unified": "10.1.2",
|
|
40
|
-
"unist-util-inspect": "7.0.
|
|
41
|
-
"yargs": "17.
|
|
40
|
+
"unist-util-inspect": "7.0.1",
|
|
41
|
+
"yargs": "17.6.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@adobe/eslint-config-helix": "1.3.2",
|
|
45
45
|
"@semantic-release/changelog": "6.0.1",
|
|
46
46
|
"@semantic-release/git": "10.0.1",
|
|
47
|
-
"@semantic-release/github": "8.0.
|
|
47
|
+
"@semantic-release/github": "8.0.6",
|
|
48
48
|
"@types/fs-extra": "9.0.13",
|
|
49
49
|
"@types/github-slugger": "1.3.0",
|
|
50
50
|
"@types/js-yaml": "4.0.5",
|
|
51
|
-
"@types/node": "
|
|
52
|
-
"@types/yargs": "17.0.
|
|
53
|
-
"c8": "7.
|
|
54
|
-
"
|
|
55
|
-
"commitizen": "4.2.4",
|
|
51
|
+
"@types/node": "18.11.9",
|
|
52
|
+
"@types/yargs": "17.0.13",
|
|
53
|
+
"c8": "7.12.0",
|
|
54
|
+
"commitizen": "4.2.5",
|
|
56
55
|
"cz-conventional-changelog": "3.3.0",
|
|
57
|
-
"eslint": "8.
|
|
56
|
+
"eslint": "8.27.0",
|
|
58
57
|
"eslint-plugin-header": "3.1.1",
|
|
59
58
|
"eslint-plugin-import": "2.26.0",
|
|
60
|
-
"husky": "8.0.
|
|
59
|
+
"husky": "8.0.2",
|
|
61
60
|
"i18n-tag-schema": "2.5.0",
|
|
62
61
|
"json-logic-js": "axa-ch/cyclic-schemas-test",
|
|
63
|
-
"lint-staged": "
|
|
64
|
-
"mocha": "10.
|
|
65
|
-
"semantic-release": "19.0.
|
|
66
|
-
"typescript": "4.
|
|
62
|
+
"lint-staged": "13.0.3",
|
|
63
|
+
"mocha": "10.1.0",
|
|
64
|
+
"semantic-release": "19.0.5",
|
|
65
|
+
"typescript": "4.8.4",
|
|
67
66
|
"unist-util-select": "4.0.1"
|
|
68
67
|
},
|
|
69
68
|
"engines": {
|