spectral
spectral copied to clipboard
PowerShell: Multiple Formater / Output does not work
Describe the bug the feature leveraging multiple formater / output is broken
To Reproduce
- spectral lint openapi.yaml -r .spectral.yaml -f junit,html
returns Invalid values: Argument: format, Given: "junit html", Choices: "json", "stylish", "junit", "html", "text", "teamcity", "pretty", "github-actions", "sarif
notice i provided a coma , but the is mentionning a space
- spectral lint openapi.yaml -r .spectral.yaml -f junit -f html -o a.junit -o a.html
return Multiple outputs have to be provided when more than a single format is specified
looks several -f is correctly interpreting as multiple formater , but not multiple output
- spectral lint openapi.yaml -r .spectral.yaml -f junit -f html -o a.junit,a.html
Returns The number of outputs must match the number of formats
at the end i do not have found the right combination that make the multiple output working (target junit, html and stdout)
Expected behavior command line working like this
i can provide either -f junit,html or -f junit -f html , and same for output
documentation for the stdout output documentation with a basic sample with for instance stdout + a formater *
notice as well that in the simple case spectral lint openapi.yaml -r .spectral.yaml -f junit -o a.junit -q true
leveraging -q true or false as no impact , wheras i would expect it has (my target beeing output on stdout + html file)
**Environment ** spectral --version : 6.11.0
+1
Invalid values:
Argument: format, Given: "json,junit", Choices: "json", "stylish", "junit", "html", "text", "teamcity", "pretty", "github-actions", "sarif"
The documentation is incorrect. The command needs to be -f json -f text
. We'll use this issue to update the docs.
Ran in the same issue. And also the documentation for multiple outputs (in combination with multiple formats) seems hard to understand
-o, --output where to output results, can be a single file name, multiple "output.<format>" or missing to print to stdout
For the part of "multiple "output.
@LasneF a working command for your usecase would be
spectral lint openapi.yaml -r .spectral.yaml -f junit -f html -o.junit a.xml -o.html a.html
@P0lip are you sure it is only documentation ; the command line you provides does not work on my side
using spectral v6.11.0 running on windows
@LasneF Could you try changing the shell to a Unix one like bash or zsh and see if it works? It might be possibly related to PowerShell - I don't know how it behaves there. There's a chance it gets parsed differently. I tried running a very similar command to yours and it completed just fine, but that's on Unix shell.
@P0lip testing on Linux looks working , so this is a powershell topic , to me it deserve the bug to be re open , or to create a dedicated one on windows , as it is still a widely used platform
@LasneF I'll follow up with that next week. I agree it's something we should at the very least document and offer a workaround.