Skip to content

Commit 4c32ed4

Browse files
bcrowedjtarazona
authored andcommitted
Add flag for internal resolving. (#295)
* Add flag for internal resolving * Add missing spaces after args
1 parent 84c78ba commit 4c32ed4

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

lib/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Config {
2020
},
2121
resolve: {
2222
output: args.output,
23+
internalRefs: args.internalRefs
2324
},
2425
serve: {
2526
port: args.port,

resolve.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const command = async (file, cmd) => {
1313
const jsonSchema = config.get('jsonSchema');
1414
const output = config.get('resolve:output');
1515
const verbose = config.get('quiet') ? 0 : config.get('verbose', 1);
16+
const internalRefs = config.get('resolve:internalRefs');
1617

1718
const spec = await loader.readOrError(
1819
file,
@@ -40,7 +41,7 @@ const command = async (file, cmd) => {
4041
});
4142
};
4243

43-
const buildLoaderOptions = (jsonSchema, verbose) => {
44+
const buildLoaderOptions = (jsonSchema, verbose, internalRefs) => {
4445
const options = {
4546
resolve: true,
4647
cache: [],
@@ -52,6 +53,7 @@ const buildLoaderOptions = (jsonSchema, verbose) => {
5253
verbose,
5354
};
5455
if (jsonSchema) options.filters.push(fromJsonSchema);
56+
if (internalRefs) options.resolveInternal = true;
5557
return options;
5658
}
5759

speccy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ function increaseVerbosity(v, total) {
1919
return total + 1;
2020
}
2121

22-
2322
program
2423
.version(version)
2524
.usage('<command>')
@@ -50,7 +49,8 @@ program
5049
.option('-o, --output <file>', 'file to output to')
5150
.option('-q, --quiet', 'reduce verbosity')
5251
.option('-j, --json-schema', 'treat $ref like JSON Schema and convert to OpenAPI Schema Objects (default: false)')
53-
.option('-v, --verbose', 'increase verbosity', increaseVerbosity,1)
52+
.option('-i, --internal-refs', 'resolve internal references (default: false)')
53+
.option('-v, --verbose', 'increase verbosity', increaseVerbosity, 1)
5454
.action((specFile, cmd) => {
5555
resolve.command(specFile, cmd)
5656
.then(() => { process.exit(0) })
@@ -68,7 +68,7 @@ program
6868
.option('-p, --port [value]', 'port on which the server will listen (default: 5000)')
6969
.option('-q, --quiet', 'reduce verbosity')
7070
.option('-j, --json-schema', 'treat $ref like JSON Schema and convert to OpenAPI Schema Objects (default: false)')
71-
.option('-v, --verbose', 'increase verbosity', increaseVerbosity,1)
71+
.option('-v, --verbose', 'increase verbosity', increaseVerbosity, 1)
7272
// TODO .option('-w, --watch', 'reloading browser on spec file changes')
7373
.action((specFile, cmd) => {
7474
serve.command(specFile, cmd)

0 commit comments

Comments
 (0)