Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --quiet switch #172

Closed
1 of 2 tasks
michaeljmcd opened this issue Apr 30, 2019 · 5 comments · Fixed by #260
Closed
1 of 2 tasks

Add --quiet switch #172

michaeljmcd opened this issue Apr 30, 2019 · 5 comments · Fixed by #260
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers released

Comments

@michaeljmcd
Copy link

michaeljmcd commented Apr 30, 2019

I'm submitting a...

  • bug report
  • feature request

What is the current behavior?

Running Spectral lint with JSON output and then piping standard output to another program fails because the logging to standard output gets sent along with the JSON output and fails to parse.

For example, imagine an invalid OpenAPI document consisting only of:

openapi: 3.0.1

Running an incredibly simple pipeline like this fails:

$ spectral lint --format=json c.yaml | jq '.[]'                                                    
parse error: Invalid numeric literal at line 1, column 8 

Because stdout looks like this:

Linting c.yaml                                                                        
OpenAPI 3.x detected                                                          
[                                                                                     
        {                                                                             
                "code": "info-contact",   

What is the expected behavior?

Standard output with JSON output should be parseable so that spectral can be used in scripts.

What is the motivation / use case for changing the behavior?

Using Spectral in a script. It is possible to work around this by dumping the JSON to a temp file with -o, but that complicates some scripts.

Please tell us about your environment:

  • Version: 2.1.0
  • Framework: [ ]
  • Language: [all]
> $ spectral --version
@stoplight/spectral/2.1.0 linux-x64 node-v10.12.0

Other information

N/A

@philsturgeon
Copy link
Contributor

I think this is more of a feature request for a --quiet switch. It's helpful for some output to happen by default because it acts as a guide for people who are still learning how the tool works. There is --verbose which gets way more chatty, so we can add --quiet which does nothing at all. This is fairly standard with things like apt-get being shushed with -y instead of asking for stdin yes/no, etc.

@philsturgeon philsturgeon added enhancement New feature or request good first issue Good for newcomers labels May 17, 2019
@philsturgeon philsturgeon changed the title Logging makes JSON output on stdout invalid Add --quiet switch May 17, 2019
@lag-of-death
Copy link
Contributor

This is now in progress

@lag-of-death
Copy link
Contributor

Unfortunately, this had to be parked for now. Will put back in progress as soon as possible.

@P0lip P0lip self-assigned this Jun 17, 2019
@P0lip
Copy link
Contributor

P0lip commented Jun 17, 2019

This is in progress again.

@stoplight-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants