Skip to content

Commit

Permalink
Fix: asyncapi#861 fail-severity warn info
Browse files Browse the repository at this point in the history
  • Loading branch information
shawakash committed Nov 4, 2023
1 parent b2c714f commit 02e836e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/commands/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ export default class Validate extends Command {
const { args, flags } = await this.parse(Validate); //NOSONAR
const filePath = args['spec-file'];
const watchMode = flags.watch;

const specFile = await load(filePath);
if (watchMode) {
specWatcher({ spec: specFile, handler: this, handlerName: 'validate' });
}

await validate(this, specFile, flags);
if(await validate(this, specFile, flags) == 'invalid') {
this.exit(1);
}
this.exit(0);
}
}
2 changes: 1 addition & 1 deletion src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function logDiagnostics(diagnostics: Diagnostic[], command: Command, specFile: S
const logDiagnostics = options['log-diagnostics'];
const failSeverity = options['fail-severity'] ?? 'error';
const diagnosticsFormat = options['diagnostics-format'] ?? 'stylish';

const sourceString = specFile.toSourceString();
if (diagnostics.length) {
if (hasFailSeverity(diagnostics, failSeverity)) {
Expand Down

0 comments on commit 02e836e

Please sign in to comment.