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

Make it easier to detect unsupported formats #678

Closed
nulltoken opened this issue Oct 13, 2019 · 0 comments · Fixed by #798
Closed

Make it easier to detect unsupported formats #678

nulltoken opened this issue Oct 13, 2019 · 0 comments · Fixed by #798
Assignees
Labels
enhancement New feature or request

Comments

@nulltoken
Copy link
Contributor

User story.
As a API Manager, I can easily distinguish that some of the files I'm trying to lint are unfit, so that I can refine my selection process (if I'm blindly globbing too widely) or even fix my files (would that be required).

Given the following file

nope.yaml:

%YAML 1.2
---
openapi: 30.0

nope: indeed

Running Spectral against it provides me with a less than rich experience an experience that could be greatly improved 😉

$ yarn spectral lint ./nope.yaml
No errors or warnings found!

Done in 1.30s.

Indeed, I may think that my file is perfect and that it passed all the many built-in checks Spectral comes up with.

Whereas the sad reality is that it went through NO rule at all.

Spectral cli only hints when a supported format is found.

This might become a bit more confusing now that Spectral accepts multiple paths and even globs.

Describe the solution you'd like

I'd really like to turn that into a positive visual indicator for the user. One idea would be to turn this into a "rule-like" feedback (that the user could optionally control through a ruleset (silencing it or raising its default severity error, for instance))

$ yarn spectral lint ./nope.yaml
c:/nope.yaml
  1:1   info  unrecognized-format   Provided file format doesn't match any of the built-in validator

✖ 1 problem (0 errors, 0 warnings, 1 infos)

Embedded free bonus point: Getting this feedback trough the standard pipeline would seamlessly feed the new JUnit formatter.

Additional context

An 🍎 a day keeps the 👨‍⚕️ away

@P0lip P0lip added the enhancement New feature or request label Oct 13, 2019
@P0lip P0lip self-assigned this Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants