@adobe/jsonschema2md 7.1.2 → 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 CHANGED
@@ -1,3 +1,10 @@
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
+
1
8
  ## [7.1.2](https://github.com/adobe/jsonschema2md/compare/v7.1.1...v7.1.2) (2022-10-06)
2
9
 
3
10
 
@@ -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
- && typeof schema[s.meta][prop.name] === 'object'
282
- && schema[s.meta][prop.name].link
283
- && schema[s.meta][prop.name].text) {
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
- link(
402
- `${additional[s.slug]}.md`,
403
- i18n`check type definition`,
404
- text(gentitle(additional[s.titles], additional[keyword`type`])),
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
- link(`${schema[keyword`contains`][s.slug]}.md`, i18n`check type definition`, text(gentitle(schema[keyword`contains`][s.titles], schema[keyword`contains`][keyword`type`])))]));
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
- link(`${schema[keyword`contains`][s.slug]}.md`, i18n`check type definition`, text(gentitle(schema[keyword`contains`][s.titles], schema[keyword`contains`][keyword`type`])))]));
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/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.2",
4
+ "version": "7.1.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "types",
7
7
  "bin": {
@@ -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": "1.4.0",
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",
@@ -38,7 +38,7 @@
38
38
  "remark-stringify": "10.0.2",
39
39
  "unified": "10.1.2",
40
40
  "unist-util-inspect": "7.0.1",
41
- "yargs": "17.6.0"
41
+ "yargs": "17.6.2"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@adobe/eslint-config-helix": "1.3.2",
@@ -48,19 +48,19 @@
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": "16.11.63",
51
+ "@types/node": "18.11.9",
52
52
  "@types/yargs": "17.0.13",
53
53
  "c8": "7.12.0",
54
54
  "commitizen": "4.2.5",
55
55
  "cz-conventional-changelog": "3.3.0",
56
- "eslint": "8.24.0",
56
+ "eslint": "8.27.0",
57
57
  "eslint-plugin-header": "3.1.1",
58
58
  "eslint-plugin-import": "2.26.0",
59
- "husky": "8.0.1",
59
+ "husky": "8.0.2",
60
60
  "i18n-tag-schema": "2.5.0",
61
61
  "json-logic-js": "axa-ch/cyclic-schemas-test",
62
62
  "lint-staged": "13.0.3",
63
- "mocha": "10.0.0",
63
+ "mocha": "10.1.0",
64
64
  "semantic-release": "19.0.5",
65
65
  "typescript": "4.8.4",
66
66
  "unist-util-select": "4.0.1"