Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Config {
},
resolve: {
output: args.output,
internalRefs: args.internalRefs
},
serve: {
port: args.port,
Expand Down
4 changes: 3 additions & 1 deletion resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const command = async (file, cmd) => {
const jsonSchema = config.get('jsonSchema');
const output = config.get('resolve:output');
const verbose = config.get('quiet') ? 0 : config.get('verbose', 1);
const internalRefs = config.get('resolve:internalRefs');

const spec = await loader.readOrError(
file,
Expand Down Expand Up @@ -40,7 +41,7 @@ const command = async (file, cmd) => {
});
};

const buildLoaderOptions = (jsonSchema, verbose) => {
const buildLoaderOptions = (jsonSchema, verbose, internalRefs) => {
const options = {
resolve: true,
cache: [],
Expand All @@ -52,6 +53,7 @@ const buildLoaderOptions = (jsonSchema, verbose) => {
verbose,
};
if (jsonSchema) options.filters.push(fromJsonSchema);
if (internalRefs) options.resolveInternal = true;
return options;
}

Expand Down
6 changes: 3 additions & 3 deletions speccy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ function increaseVerbosity(v, total) {
return total + 1;
}


program
.version(version)
.usage('<command>')
Expand Down Expand Up @@ -50,7 +49,8 @@ program
.option('-o, --output <file>', 'file to output to')
.option('-q, --quiet', 'reduce verbosity')
.option('-j, --json-schema', 'treat $ref like JSON Schema and convert to OpenAPI Schema Objects (default: false)')
.option('-v, --verbose', 'increase verbosity', increaseVerbosity,1)
.option('-i, --internal-refs', 'resolve internal references (default: false)')
.option('-v, --verbose', 'increase verbosity', increaseVerbosity, 1)
.action((specFile, cmd) => {
resolve.command(specFile, cmd)
.then(() => { process.exit(0) })
Expand All @@ -68,7 +68,7 @@ program
.option('-p, --port [value]', 'port on which the server will listen (default: 5000)')
.option('-q, --quiet', 'reduce verbosity')
.option('-j, --json-schema', 'treat $ref like JSON Schema and convert to OpenAPI Schema Objects (default: false)')
.option('-v, --verbose', 'increase verbosity', increaseVerbosity,1)
.option('-v, --verbose', 'increase verbosity', increaseVerbosity, 1)
// TODO .option('-w, --watch', 'reloading browser on spec file changes')
.action((specFile, cmd) => {
serve.command(specFile, cmd)
Expand Down