@adobe/jsonschema2md 8.1.1 → 8.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,17 @@
1
+ ## [8.1.3](https://github.com/adobe/jsonschema2md/compare/v8.1.2...v8.1.3) (2026-12-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update external majors and Node.js 26 ([23b645c](https://github.com/adobe/jsonschema2md/commit/23b645c10145399404deaf05f37904c7803edbcb))
7
+
8
+ ## [8.1.2](https://github.com/adobe/jsonschema2md/compare/v8.1.1...v8.1.2) (2026-12-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * preserve generated page slugs when resolving references again ([846c388](https://github.com/adobe/jsonschema2md/commit/846c388d4afc5e1d470c2dd81a28ed5370eac331)), closes [#680](https://github.com/adobe/jsonschema2md/issues/680)
14
+
1
15
  ## [8.1.1](https://github.com/adobe/jsonschema2md/compare/v8.1.0...v8.1.1) (2026-12-04)
2
16
 
3
17
 
package/lib/index.js CHANGED
@@ -33,19 +33,19 @@ const __dirname = nodepath.dirname(__filename);
33
33
  const { debug, info, error } = console;
34
34
 
35
35
  /**
36
- * @typedef {import("../types/api").JsonSchema} JsonSchema
36
+ * @typedef {import("../types/api.js").JsonSchema} JsonSchema
37
37
  */
38
38
  /**
39
- * @typedef {import("../types/api").SchemaList} SchemaList
39
+ * @typedef {import("../types/api.js").SchemaList} SchemaList
40
40
  */
41
41
  /**
42
- * @typedef {import("../types/api").SchemaContent} SchemaContent
42
+ * @typedef {import("../types/api.js").SchemaContent} SchemaContent
43
43
  */
44
44
  /**
45
- * @typedef {import("../types/api").SchemaFiles} SchemaFiles
45
+ * @typedef {import("../types/api.js").SchemaFiles} SchemaFiles
46
46
  */
47
47
  /**
48
- * @typedef {import("../types/api").GeneratedOutput} GeneratedOutput
48
+ * @typedef {import("../types/api.js").GeneratedOutput} GeneratedOutput
49
49
  */
50
50
 
51
51
  /**
@@ -30,7 +30,7 @@ import {
30
30
  } from 'mdast-builder';
31
31
  import i from 'es2015-i18n-tag';
32
32
  import GhSlugger from 'github-slugger';
33
- import yaml from 'js-yaml';
33
+ import * as yaml from 'js-yaml';
34
34
  import s from './symbols.js';
35
35
  import { gentitle } from './formattingTools.js';
36
36
  import { keyword } from './keywords.js';
@@ -42,7 +42,7 @@ function makeversionnote(schemas) {
42
42
  /**
43
43
  * Generate the README.md
44
44
  * @param {object} opts
45
- * @returns {function(Array): import('unist').Parent|null}
45
+ * @returns {(schemas: Array) => import('unist').Parent|null}
46
46
  */
47
47
  export default function build({ readme = true }) {
48
48
  return (schemas) => {
@@ -152,10 +152,14 @@ const handler = ({
152
152
 
153
153
  if (referenced !== null) {
154
154
  // inject the referenced schema into the current schema
155
+ const slug = retval[myslug];
155
156
  Object.assign(retval, referenced);
156
157
  if (referenced && referenced[keyword`$id`]) {
157
158
  // Traversal deduplicates schema IDs, so reuse the referenced page's slug.
158
159
  retval[myslug] = referenced[symbols.slug];
160
+ } else if (slug !== undefined) {
161
+ // Earlier links may already use this page's slug; resolving again must not change it.
162
+ retval[myslug] = slug;
159
163
  }
160
164
  } else {
161
165
  console.error('cannot resolve', basedoc);
package/lib/symbols.js CHANGED
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  /**
14
- * @typedef {import("../types/api").UniqueSymbols} UniqueSymbols
14
+ * @typedef {import("../types/api.js").UniqueSymbols} UniqueSymbols
15
15
  */
16
16
 
17
17
  export const filename = Symbol('filename');
@@ -15,16 +15,16 @@ import { unified } from 'unified';
15
15
  import gfm from 'remark-gfm';
16
16
  import path from 'path';
17
17
  import fs from 'fs-extra';
18
- import yaml from 'js-yaml';
18
+ import * as yaml from 'js-yaml';
19
19
 
20
20
  /**
21
- * @typedef {import("../types/api").MarkdownAst} MarkdownAst
21
+ * @typedef {import("../types/api.js").MarkdownAst} MarkdownAst
22
22
  */
23
23
  /**
24
- * @typedef {import("../types/api").MarkdownContent} MarkdownContent
24
+ * @typedef {import("../types/api.js").MarkdownContent} MarkdownContent
25
25
  */
26
26
  /**
27
- * @typedef {import("../types/api").ReadmeContent} ReadmeContent
27
+ * @typedef {import("../types/api.js").ReadmeContent} ReadmeContent
28
28
  */
29
29
  /**
30
30
  * @typedef {{ [name: string]: MarkdownAst }} MarkdownAstFiles
@@ -14,10 +14,10 @@ import path from 'path';
14
14
  import s from './symbols.js';
15
15
 
16
16
  /**
17
- * @typedef {import("../types/api").ExtendedJsonSchema} ExtendedJsonSchema
17
+ * @typedef {import("../types/api.js").ExtendedJsonSchema} ExtendedJsonSchema
18
18
  */
19
19
  /**
20
- * @typedef {import("../types/api").SchemaContent} SchemaContent
20
+ * @typedef {import("../types/api.js").SchemaContent} SchemaContent
21
21
  */
22
22
 
23
23
  /**
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": "8.1.1",
4
+ "version": "8.1.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "types",
7
7
  "bin": {
@@ -27,7 +27,7 @@
27
27
  "ferrum": "1.9.4",
28
28
  "fs-extra": "11.4.1",
29
29
  "github-slugger": "2.0.0",
30
- "js-yaml": "4.3.2",
30
+ "js-yaml": "5.5.0",
31
31
  "json-schema": "^0.4.0",
32
32
  "mdast-builder": "1.1.1",
33
33
  "mdast-util-to-string": "4.0.0",
@@ -42,23 +42,22 @@
42
42
  "devDependencies": {
43
43
  "@adobe/eslint-config-helix": "3.0.35",
44
44
  "@eslint/config-helpers": "0.7.0",
45
- "@semantic-release/changelog": "6.0.3",
46
- "@semantic-release/git": "10.0.1",
45
+ "@semantic-release/changelog": "7.0.0",
46
+ "@semantic-release/git": "11.0.1",
47
47
  "@semantic-release/github": "12.0.11",
48
48
  "@types/fs-extra": "11.0.4",
49
49
  "@types/github-slugger": "2.0.0",
50
- "@types/js-yaml": "4.0.9",
51
- "@types/node": "24.19.2",
50
+ "@types/node": "26.6.6",
52
51
  "@types/yargs": "17.0.35",
53
- "c8": "11.0.0",
52
+ "c8": "12.0.0",
54
53
  "eslint": "9.39.5",
55
54
  "husky": "9.1.7",
56
55
  "i18n-tag-schema": "2.5.0",
57
56
  "json-logic-js": "axa-ch/cyclic-schemas-test",
58
57
  "lint-staged": "17.6.1",
59
- "mocha": "11.8.0",
58
+ "mocha": "12.0.3",
60
59
  "semantic-release": "25.0.9",
61
- "typescript": "6.0.3",
60
+ "typescript": "7.0.2",
62
61
  "unist-util-select": "5.1.0"
63
62
  },
64
63
  "engines": {
@@ -1,10 +1,10 @@
1
1
  export default function formatmeta(schema: any): {
2
- longcomment: import("mdast").Root;
3
- shortcomment: any;
4
- comment: string;
5
2
  longdescription: import("mdast").Root;
6
3
  shortdescription: any;
7
4
  description: any;
5
+ longcomment: import("mdast").Root;
6
+ shortcomment: any;
7
+ comment: string;
8
8
  abstract: boolean;
9
9
  extensible: boolean;
10
10
  status: any;
@@ -1,2 +1,2 @@
1
- export function gentitle(titles: any, type: any): any;
2
- export function gendescription(schema: any): any;
1
+ export declare function gentitle(titles: any, type: any): any;
2
+ export declare function gendescription(schema: any): any;
package/types/index.d.ts CHANGED
@@ -1,17 +1,22 @@
1
+ export type JsonSchema = import("../types/api.js").JsonSchema;
2
+ export type SchemaList = import("../types/api.js").SchemaList;
3
+ export type SchemaContent = import("../types/api.js").SchemaContent;
4
+ export type SchemaFiles = import("../types/api.js").SchemaFiles;
5
+ export type GeneratedOutput = import("../types/api.js").GeneratedOutput;
1
6
  /**
2
- * @typedef {import("../types/api").JsonSchema} JsonSchema
7
+ * @typedef {import("../types/api.js").JsonSchema} JsonSchema
3
8
  */
4
9
  /**
5
- * @typedef {import("../types/api").SchemaList} SchemaList
10
+ * @typedef {import("../types/api.js").SchemaList} SchemaList
6
11
  */
7
12
  /**
8
- * @typedef {import("../types/api").SchemaContent} SchemaContent
13
+ * @typedef {import("../types/api.js").SchemaContent} SchemaContent
9
14
  */
10
15
  /**
11
- * @typedef {import("../types/api").SchemaFiles} SchemaFiles
16
+ * @typedef {import("../types/api.js").SchemaFiles} SchemaFiles
12
17
  */
13
18
  /**
14
- * @typedef {import("../types/api").GeneratedOutput} GeneratedOutput
19
+ * @typedef {import("../types/api.js").GeneratedOutput} GeneratedOutput
15
20
  */
16
21
  /**
17
22
  * Public API for jsonschema2md that can be used to turn JSON Schema files
@@ -44,7 +49,7 @@
44
49
  * per schema, inlining all property documentation instead of creating separate files.
45
50
  * @returns {GeneratedOutput} List of raw markdown that were generated from input schema.
46
51
  */
47
- export function jsonschema2md(schema: JsonSchema | SchemaFiles, options: {
52
+ export declare function jsonschema2md(schema: JsonSchema | SchemaFiles, options: {
48
53
  schemaPath?: string;
49
54
  outDir?: string;
50
55
  metadata?: {
@@ -68,11 +73,6 @@ export function jsonschema2md(schema: JsonSchema | SchemaFiles, options: {
68
73
  * @param {{ [key:string]: unknown }} args CLI arguments from user input
69
74
  * @returns The generated Markdown files to the specified output directory
70
75
  */
71
- export function main(args: {
76
+ export declare function main(args: {
72
77
  [key: string]: unknown;
73
78
  }): Promise<number>;
74
- export type JsonSchema = import("../types/api").JsonSchema;
75
- export type SchemaList = import("../types/api").SchemaList;
76
- export type SchemaContent = import("../types/api").SchemaContent;
77
- export type SchemaFiles = import("../types/api").SchemaFiles;
78
- export type GeneratedOutput = import("../types/api").GeneratedOutput;
@@ -1,2 +1,2 @@
1
- export function keyword(str: any): any;
2
- export function report(): Set<any>;
1
+ export declare function keyword(str: any): any;
2
+ export declare function report(): Set<any>;
@@ -1,8 +1,8 @@
1
1
  export default function build({ header, links, includeProperties, rewritelinks, exampleFormat, skipProperties: rawSkipProperties, singleFile, }?: {
2
- links?: {};
2
+ exampleFormat?: string;
3
3
  includeProperties?: any[];
4
+ links?: {};
4
5
  rewritelinks?: (x: any) => any;
5
- exampleFormat?: string;
6
- skipProperties?: any[];
7
6
  singleFile?: boolean;
7
+ skipProperties?: any[];
8
8
  }): (schemas: any) => any;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Generate the README.md
3
3
  * @param {object} opts
4
- * @returns {function(Array): import('unist').Parent|null}
4
+ * @returns {(schemas: Array) => import('unist').Parent|null}
5
5
  */
6
- export default function build({ readme }: object): (arg0: any[]) => import("unist").Parent | null;
6
+ export default function build({ readme }: object): (schemas: any[]) => import('unist').Parent | null;
@@ -1,11 +1,11 @@
1
+ export type UniqueSymbols = import("../types/api.js").UniqueSymbols;
1
2
  /**
2
- * @typedef {import("../types/api").UniqueSymbols} UniqueSymbols
3
+ * @typedef {import("../types/api.js").UniqueSymbols} UniqueSymbols
3
4
  */
4
- export const filename: unique symbol;
5
- export const fullpath: unique symbol;
6
- export default symbols;
7
- export type UniqueSymbols = import("../types/api").UniqueSymbols;
5
+ export declare const filename: unique symbol;
6
+ export declare const fullpath: unique symbol;
8
7
  /**
9
8
  * @type {UniqueSymbols}
10
9
  * */
11
10
  declare const symbols: UniqueSymbols;
11
+ export default symbols;
@@ -1,11 +1,17 @@
1
+ export type MarkdownAst = import("../types/api.js").MarkdownAst;
2
+ export type MarkdownContent = import("../types/api.js").MarkdownContent;
3
+ export type ReadmeContent = import("../types/api.js").ReadmeContent;
4
+ export type MarkdownAstFiles = {
5
+ [name: string]: MarkdownAst;
6
+ };
1
7
  /**
2
- * @typedef {import("../types/api").MarkdownAst} MarkdownAst
8
+ * @typedef {import("../types/api.js").MarkdownAst} MarkdownAst
3
9
  */
4
10
  /**
5
- * @typedef {import("../types/api").MarkdownContent} MarkdownContent
11
+ * @typedef {import("../types/api.js").MarkdownContent} MarkdownContent
6
12
  */
7
13
  /**
8
- * @typedef {import("../types/api").ReadmeContent} ReadmeContent
14
+ * @typedef {import("../types/api.js").ReadmeContent} ReadmeContent
9
15
  */
10
16
  /**
11
17
  * @typedef {{ [name: string]: MarkdownAst }} MarkdownAstFiles
@@ -20,7 +26,7 @@
20
26
  * @param {{ [key: string]: string }} [options.meta] - (optional) Metadata to be added to Markdown
21
27
  * @returns {(astFiles: MarkdownAstFiles) => MarkdownContent[]}
22
28
  */
23
- export function writemarkdown({ out, error, meta, }: {
29
+ export declare function writemarkdown({ out, error, meta, }: {
24
30
  out?: string;
25
31
  error?: Function;
26
32
  info?: Function;
@@ -39,7 +45,7 @@ export function writemarkdown({ out, error, meta, }: {
39
45
  * @param {{ [key: string]: string }} [options.meta] - (optional) Metadata to be added to Markdown
40
46
  * @returns {(markdownAst: MarkdownAst) => ReadmeContent}
41
47
  */
42
- export function writereadme({ out, error, info, meta, }: {
48
+ export declare function writereadme({ out, error, info, meta, }: {
43
49
  out?: string;
44
50
  error?: Function;
45
51
  info?: Function;
@@ -48,9 +54,3 @@ export function writereadme({ out, error, info, meta, }: {
48
54
  [key: string]: string;
49
55
  };
50
56
  }): (markdownAst: MarkdownAst) => ReadmeContent;
51
- export type MarkdownAst = import("../types/api").MarkdownAst;
52
- export type MarkdownContent = import("../types/api").MarkdownContent;
53
- export type ReadmeContent = import("../types/api").ReadmeContent;
54
- export type MarkdownAstFiles = {
55
- [name: string]: MarkdownAst;
56
- };
@@ -1,8 +1,10 @@
1
+ export type ExtendedJsonSchema = import("../types/api.js").ExtendedJsonSchema;
2
+ export type SchemaContent = import("../types/api.js").SchemaContent;
1
3
  /**
2
- * @typedef {import("../types/api").ExtendedJsonSchema} ExtendedJsonSchema
4
+ * @typedef {import("../types/api.js").ExtendedJsonSchema} ExtendedJsonSchema
3
5
  */
4
6
  /**
5
- * @typedef {import("../types/api").SchemaContent} SchemaContent
7
+ * @typedef {import("../types/api.js").SchemaContent} SchemaContent
6
8
  */
7
9
  /**
8
10
  * Write the JSON Schemas to filesystem or an object
@@ -15,5 +17,3 @@ export default function writeSchema({ schemadir, origindir }: {
15
17
  schemadir?: string;
16
18
  origindir?: string;
17
19
  }): (schemas: ExtendedJsonSchema[]) => SchemaContent[];
18
- export type ExtendedJsonSchema = import("../types/api").ExtendedJsonSchema;
19
- export type SchemaContent = import("../types/api").SchemaContent;