-
-
Notifications
You must be signed in to change notification settings - Fork 238
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
docs(repo): update rulesets loading procedure #1797
Conversation
0275eae
to
8a26c76
Compare
@@ -44,7 +44,8 @@ The Spectral CLI supports loading documents as YAML or JSON, and validation of O | |||
|
|||
## Using a Ruleset File | |||
|
|||
If you don't specify a ruleset file with the `--ruleset` parameter, the Spectral CLI will look for a ruleset file called `.spectral.yml`, `.spectral.yaml`, or `.spectral.json` in the current working directory. If no ruleset is specified and no default ruleset file is found, the built-in rulesets will be used. | |||
If you don't specify a ruleset file with the `--ruleset` parameter, the Spectral CLI will look for a ruleset file called `.spectral.yml`, `.spectral.yaml`, `.spectral.json` or `.spectral.js` in the current working directory. | |||
Spectral will refuse to lint the document if no ruleset is specified and no default ruleset file is found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is meant to be a new paragraph it will need another line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can have a separate paragraph, sure.
Spectral will refuse to lint the document if no ruleset is specified and no default ruleset file is found. | |
Spectral will refuse to lint the document if no ruleset is specified and no default ruleset file is found. | |
If you want to have a simple basic ruleset for OpenAPI, this command will let you get started: | |
`echo "extends: spectral:oas" > .spectral.yaml` |
@philsturgeon thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this new behavior in Spectral v6? We used to autodetect and apply OAS if we thought it was OAS, but now folks have to specify that for theirselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just ran up against this change and found this confusing behaviour. A few other people in #1796 had a similar experience from the sound of things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops, I lost sight of these comments.
Is this new behavior in Spectral v6? We used to autodetect and apply OAS if we thought it was OAS, but now folks have to specify that for theirselves?
Yeah, it's a deliberate change we've made.
Overall, from a technical standpoint it is quite trivial to load some default ruleset - would probably be like a one-liner kind of a change if we were to make it, so totally straightforward to do.
Our goal was to convince users to write their own style guides, but I'm all in for constant reiteration of the standpoint if this happens to be truly annoying - I believe that most of folks do have some kind of a ruleset, so this change is seamless for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks for clarifying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```bash | ||
echo '{\n\t"extends": ["spectral:oas", "spectral:asyncapi"]\n}' > .spectral.json | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add a callout to say that this is a breaking change moving to V6
Checklist
Does this PR introduce a breaking change?