The following error occurs when defining.spectral.js
in a project repo which would extend a ruleset from a private NPM package (in this case @team-supercharge/oasg/ruleset
)
import oasgRuleset from '@team-supercharge/oasg/ruleset'; export default { extends: oasgRuleset, }
The extension seems to be trying to load the dependency from a CDN, previous versions (using Spectral 5) used to correctly trying to load the @team-supercharge/oasg/ruleset
locally from the node_modules
directory.
[Error - 09:43:31] An error occurred while validating document /Users/bali/Devel/project/api/spec.openapi.yaml: Unable to read ruleset at /Users/bali/Devel/project/.spectral.js. Error: Could not load https://cdn.skypack.dev/-/@team-supercharge/oasg@v10.0.2-2VJzdTnx52EvLlWlHHZk/dist=es2019,mode=raw/ruleset (imported by https://cdn.skypack.dev/@team-supercharge/oasg/ruleset): Error fetching https://cdn.skypack.dev/-/@team-supercharge/oasg@v10.0.2-2VJzdTnx52EvLlWlHHZk/dist=es2019,mode=raw/ruleset: Not Found
When using a YAML ruleset .spectral.yaml
the following error occurs:
extends: '@team-supercharge/oasg/ruleset'
[Error - 09:59:44] An error occurred while validating document /Users/bali/Devel/project/api/spec.openapi.yaml: Unable to read ruleset at /Users/bali/Devel/project/.spectral.yaml. Error: Could not load /Users/bali/Devel/project/@team-supercharge/oasg/ruleset (imported by .spectral.js): ENOENT: no such file or directory, open '/Users/bali/Devel/project/@team-supercharge/oasg/ruleset'
In this case the extension tries to load the ruleset from the project folder, instead of from inside node_modules
.
In both cases running Spectral from the CLI works totally fine.
Environment:
sduc, SirAppSec and kennethaasanadamdharrington
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4