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

Switching rules "off" doesn't work when using chain of inherited rulesets #2211

Closed
pavelkornev opened this issue Jul 21, 2022 · 2 comments · Fixed by #2326
Closed

Switching rules "off" doesn't work when using chain of inherited rulesets #2211

pavelkornev opened this issue Jul 21, 2022 · 2 comments · Fixed by #2326
Assignees
Labels
p/medium released t/bug Something isn't working

Comments

@pavelkornev
Copy link
Contributor

pavelkornev commented Jul 21, 2022

If there is an hierarchy of rulesets (let’s say 5 inherited rulesets one from each other), then in the top ruleset in the extends field I switch off all the rules, Spectral disables only rules from the direct parent, but not the rule of the other ancestors (parent-parent...).

Example:

const ruleset3 = {
    extends: [ruleset2],
    rules: { … }
}
const ruleset4 = {
    extends: [ruleset3],
    rules: { … }
}
const ruleset5 = {
   extends: [[ruleset4, “off”]],
    rules: { … }
}

It disables only rules from the ruleset4 (direct parent), but not from the ruleset3 and further ancestors.

To Reproduce

  1. Checkout the repository - https://github.com/pavelkornev/spectral-example/
  2. Run npm start
  3. There should be no validation errors as they are all switched off, but there will be an error coming from the rule defined in ruleset1.
  4. See https://github.com/pavelkornev/spectral-example/blob/master/src/index.ts#L14-L52

Expected behavior

When inheriting ruleset, it's expected that no matter how many ancestors it has, if I switch off all inherited rules, they must be switched off.

@philsturgeon philsturgeon added the t/bug Something isn't working label Jul 26, 2022
@P0lip P0lip added the p/medium label Jul 28, 2022
@P0lip P0lip self-assigned this Nov 2, 2022
@stoplight-bot
Copy link
Collaborator

🎉 This issue has been resolved in version @stoplight/spectral-core-v1.15.2 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@stoplight-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 6.7.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
p/medium released t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants