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

feat(cli): demand some ruleset to be present #1699

Merged
merged 2 commits into from
Jul 6, 2021

Conversation

P0lip
Copy link
Contributor

@P0lip P0lip commented Jun 29, 2021

Related to #1698

Checklist

  • Tests added / updated
  • Docs added / updated

Does this PR introduce a breaking change?

  • Yes
  • No

Additional context

Bear in mind that this only relevant to the situation where you do not provide a ruleset and have no .spectral.{js,json,yaml,yml} at the same time.
We no longer load any default ruleset, thus it's on user now to specify some.

@P0lip P0lip added enhancement New feature or request breaking Pull requests that introduce a breaking change labels Jun 29, 2021
@P0lip P0lip self-assigned this Jun 29, 2021
@P0lip P0lip force-pushed the chore/cli/demand-ruleset-file branch from 3959353 to de8e994 Compare July 6, 2021 14:26
@P0lip P0lip marked this pull request as ready for review July 6, 2021 14:33
@P0lip P0lip requested a review from mnaumanali94 July 6, 2021 14:33
@P0lip P0lip enabled auto-merge (squash) July 6, 2021 14:33
Copy link
Contributor

@billiegoose billiegoose left a comment

Choose a reason for hiding this comment

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

Can we change the error message for the CLI to say something like "Please provide a ruleset using the --ruleset CLI argument" or maybe just print the standard "Usage: " when it's used incorrectly? (So that users are told how to use it correctly instead of just told an error)

@P0lip P0lip requested a review from billiegoose July 6, 2021 18:45
@billiegoose
Copy link
Contributor

Thanks!

@P0lip P0lip merged commit 3baba29 into develop Jul 6, 2021
@P0lip P0lip deleted the chore/cli/demand-ruleset-file branch July 6, 2021 18:52
@stoplight-bot
Copy link
Collaborator

🎉 This PR is included in version @stoplight/spectral-cli-v1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@stoplight-bot
Copy link
Collaborator

🎉 This PR is included in version @stoplight/spectral-core-v1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

stoplight-bot pushed a commit that referenced this pull request Jul 8, 2021
# @stoplight/spectral-cli-v1.0.0 (2021-07-08)

### Features

* **cli:** demand some ruleset to be present ([#1699](#1699)) ([3baba29](3baba29))
* **cli:** implement --stdin-filepath flag ([#1712](#1712)) ([45b15a2](45b15a2))
* **core:** support overrides in rulesets ([#1684](#1684)) ([153d685](153d685))
* **core:** use double quotes in errors reported by Ajv ([#1718](#1718)) ([dd2a166](dd2a166))
* **ruleset-migrator:** implement ruleset migrator  ([#1698](#1698)) ([efa5c50](efa5c50))
* **ruleset-migrator:** inline external rulesets & support exceptions  ([#1711](#1711)) ([2a1d2d3](2a1d2d3))
@dolmen
Copy link

dolmen commented Sep 28, 2021

My CI build that use the latest version of Spectral to validate OpenAPI specs, now fails because of this change.

Where can I find the upgrade guide that will tell me where I can find a generic ruleset (which was not needed before)? There is nothing helpful in the CHANGELOG.

@P0lip
Copy link
Contributor Author

P0lip commented Sep 28, 2021

Hey @dolmen!
It's in the readme
image

echo '{\n\t"extends": ["spectral:oas"]\n}' > .spectral.json

and we have a more extensive guide about style guides over here https://github.com/stoplightio/spectral/blob/develop/docs/getting-started/3-rulesets.md

There's also a migration guide available https://github.com/stoplightio/spectral/blob/develop/docs/migration-guides/6.0.md

@dolmen
Copy link

dolmen commented Sep 29, 2021

I did this because that's what is written in the ruleset documentation:

echo 'extends: "spectral:oas"' > .spectral.yml

I notice that here extends takes a string while you wrote above like it takes an array. Which is right? Is there a built-in ruleset to validate Spectral rulesets (edit: added #1853)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Pull requests that introduce a breaking change enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants