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

docs(repo): update rulesets loading procedure #1797

Merged
merged 5 commits into from
Sep 15, 2021
Merged

Conversation

P0lip
Copy link
Contributor

@P0lip P0lip commented Aug 31, 2021

Checklist

  • Tests added / updated
  • Docs added / updated

Does this PR introduce a breaking change?

  • Yes
  • No

@P0lip P0lip self-assigned this Aug 31, 2021
@P0lip P0lip enabled auto-merge (squash) August 31, 2021 12:58
@@ -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.
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Suggested change
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?

Copy link
Contributor

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?

Copy link

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.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for clarifying.

Copy link
Contributor

@mnaumanali94 mnaumanali94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2021-09-15 at 9 19 44 PM

Lets add a note here too please.

@P0lip P0lip merged commit 55ed5e4 into develop Sep 15, 2021
@P0lip P0lip deleted the docs/default-ruleset-note branch September 15, 2021 17:44
```bash
echo '{\n\t"extends": ["spectral:oas", "spectral:asyncapi"]\n}' > .spectral.json
```

Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants