You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] The validate subcommand does not fully support the --diagnostics-format options despite its help message #2007
asyncapi validate --help says the --diagnostics-format parameter supports 12 options, but github-actions, sarif, code-climate, gitlab and markdown are not supported actually and they generates the same result as stylish.
Expected behavior
It should support these formats or the help message should be fixed.
Screenshots
How to Reproduce
Ran the validate subcommand and ensured those five options for the --diagnostics-format parameter in the help message:
Ran the validate subcommand against any spec file with one of the options above and ensured the output format is the same as stylish:
$ bin/run validate --diagnostics-format=github-actions test/fixtures/badFormatAsyncapi.json
...
test/fixtures/badFormatAsyncapi.json
1:1 warning asyncapi-defaultContentType AsyncAPI document should have "defaultContentType" field.
1:1 warning asyncapi-id AsyncAPI document should have "id" field.
1:1 warning asyncapi-servers AsyncAPI document should have non-empty "servers" object.
1:1 warning asyncapi2-tags AsyncAPI object should have non-empty "tags" array.
2:15 information asyncapi-latest-version The latest version of AsyncAPi is not used. It is recommended update to the "3.1.0" version. asyncapi
3:10 warning asyncapi-info-contact Info object should have "contact" object. info
3:10 warning asyncapi-info-license Info object should have "license" object. info
10:19 warning asyncapi2-operation-operationId Operation should have an "operationId" field defined. channels.user/signedup.subscribe
✖ 8 problems (0 errors, 7 warnings, 1 info, 0 hints)
Hi, I can reproduce this on @asyncapi/cli 6.2.1 (Windows 11, Node 24). With --save-output, the five formats github-actions, sarif, code-climate, gitlab and markdown are rejected with Invalid diagnostics format, and on the console they silently print the stylish output.
I would like to work on this. My approach:
@stoplight/spectral-formatters 1.6.0, which the CLI already depends on, exports githubActions, sarif, codeClimate and markdown. Spectral's own CLI maps gitlab to the Code Climate formatter, so I would do the same. In src/domains/services/validation.service.ts, add the five names to validFormats, to formatExtensions and to the switch in formatDiagnosticsOutput, and extend the DiagnosticsFormat type in src/interfaces/index.ts.
Add unit tests in test/unit/services/validation.service.test.ts for each new format, console and --save-output.
While there, fix the small message bug in src/apps/cli/commands/validate.ts where this.logToStderr(error, { exit: 1 }) prints a literal { exit: 1 } at the end of the error line.
I saw #2008 by @sekikn covers part of this but has been stale since July and has conflicts. @sekikn, if you plan to continue it I am happy to help with the rebase instead. Otherwise I can open a fresh PR that credits that work.
Activity
fix: implement missing diagnostics-format options in validate command (…
1164148-7-eng commentedon Apr 21, 2026
/attempt #2007
I've claimed this issue. Working on it now! 🚀
1164148-7-eng commentedon Apr 22, 2026
/attempt #2007
I've claimed this issue. Working on it now! 🚀
1164148-7-eng commentedon Apr 23, 2026
/attempt #2007
I've claimed this issue. Working on it now! 🚀
Azizzzss commentedon Oct 15, 2026
Hi, I can reproduce this on @asyncapi/cli 6.2.1 (Windows 11, Node 24). With
--save-output, the five formatsgithub-actions,sarif,code-climate,gitlabandmarkdownare rejected withInvalid diagnostics format, and on the console they silently print thestylishoutput.I would like to work on this. My approach:
@stoplight/spectral-formatters1.6.0, which the CLI already depends on, exportsgithubActions,sarif,codeClimateandmarkdown. Spectral's own CLI mapsgitlabto the Code Climate formatter, so I would do the same. Insrc/domains/services/validation.service.ts, add the five names tovalidFormats, toformatExtensionsand to theswitchinformatDiagnosticsOutput, and extend theDiagnosticsFormattype insrc/interfaces/index.ts.test/unit/services/validation.service.test.tsfor each new format, console and--save-output.src/apps/cli/commands/validate.tswherethis.logToStderr(error, { exit: 1 })prints a literal{ exit: 1 }at the end of the error line.I saw #2008 by @sekikn covers part of this but has been stale since July and has conflicts. @sekikn, if you plan to continue it I am happy to help with the rebase instead. Otherwise I can open a fresh PR that credits that work.