@skriptfabrik/json-schema-bundler 0.5.0 → 0.6.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/README.md +2 -1
- package/json-schema-bundler-cli.mjs +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,8 @@ Usage:
|
|
|
29
29
|
Arguments:
|
|
30
30
|
input The path of the input schema file
|
|
31
31
|
|
|
32
|
-
Options:
|
|
32
|
+
Options:
|
|
33
|
+
-c, --circular Resolving circular reference strategy, when doing dereference (-d). Possible values: true, false, ignore (default: true)
|
|
33
34
|
-d, --dereference Replacing each reference with its resolved value
|
|
34
35
|
-h, --help Display this help message
|
|
35
36
|
-p, --pretty Pretty print output
|
|
@@ -15,7 +15,9 @@ const pkg = JSON.parse(await readFile(path.join(__dirname, 'package.json')));
|
|
|
15
15
|
|
|
16
16
|
const argv = minimist(process.argv.slice(2), {
|
|
17
17
|
boolean: ['d', 'h', 'p', 's', 'v', 'y'],
|
|
18
|
+
string: ['c'],
|
|
18
19
|
alias: {
|
|
20
|
+
c: 'circular',
|
|
19
21
|
d: 'dereference',
|
|
20
22
|
h: 'help',
|
|
21
23
|
p: 'pretty',
|
|
@@ -36,6 +38,7 @@ if (argv.h || argv._.length < 1) {
|
|
|
36
38
|
` ${path.basename(process.argv[1])} [options] <input>`,
|
|
37
39
|
` ${chalk.green('input')} The path of the input schema file`,
|
|
38
40
|
[
|
|
41
|
+
` ${chalk.green('-c, --circular')} Resolving circular reference strategy, when doing dereference (-d). Possible values: true, false, ignore (default: true)`,
|
|
39
42
|
` ${chalk.green('-d, --dereference')} Replacing each reference with its resolved value`,
|
|
40
43
|
` ${chalk.green('-h, --help')} Display this help message`,
|
|
41
44
|
` ${chalk.green('-p, --pretty')} Pretty print output`,
|
|
@@ -64,7 +67,13 @@ let schema;
|
|
|
64
67
|
|
|
65
68
|
try {
|
|
66
69
|
if (argv.d) {
|
|
67
|
-
|
|
70
|
+
let circular = true;
|
|
71
|
+
if (argv.c === 'false') {
|
|
72
|
+
circular = false;
|
|
73
|
+
} else if (argv.c === 'ignore') {
|
|
74
|
+
circular = 'ignore';
|
|
75
|
+
}
|
|
76
|
+
schema = await $RefParser.dereference(input, {dereference: {circular: circular}});
|
|
68
77
|
} else {
|
|
69
78
|
schema = await $RefParser.bundle(input);
|
|
70
79
|
}
|