Forum Discussion

Stoplight's avatar
Stoplight
Community Manager
10 months ago

Need help - extending custom rulesets

Originally posted by user MeisterPoppe to the Stoplight Community on 12/03/2022 at 10:20 ET.

Hey everyone, currently we are building a library that is heavily relying on spectral-core. We have use cases that are kind of hierarchical, so say for example we are generating node services including API tests from an openapi spec and therefore we need to lint before.

On top of that there is the possibility to also generate performance tests and input is again openapi, but there are some more rules required. That’s why, the load test ruleset should extend our node ruleset. Running them individually works perfectly fine, but when it comes to extending, I am facing a problem when reading the ruleset. Can anyone help me out here?

Following this https://meta.stoplight.io/docs/spectral/83527ef2dd8c0-extending-rulesets, I use the extends keyword in the second ruleset like this:

"extends": [
      "./oas-spectral.json"
   ],

Stoplight packages:
"@stoplight/spectral-core": "^1.15.2",
    "@stoplight/spectral-parsers": "^1.0.2",
    "@stoplight/spectral-ruleset-bundler": "^1.5.0",
    "@stoplight/spectral-runtime": "^1.1.2",

Node version: 16
Ruleset defined in JSON
Platform macOS 

Any help appreciated!  πŸš€πŸš€πŸš€