Load multiple ruleset files #1954
Unanswered
Andras-Csanyi
asked this question in
General
Replies: 1 comment 1 reply
-
|
As mentioned here #1956, I'm going provide to a util to make it easier to load a YAML/JSON ruleset when using Spectral programmatically. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All,
In our validator Spectral is utilised and we are in the situation where two ruleset files should be loaded.
The use cases:
fantastic-rulesets, if the this npm package is not installed then the validator app fails.spectral.yamlfile, it mustextendthefantastic-rulesetspackageLoading the npm package is easy, I created a loader which pulls the rules together in an object and will be handed over Spectral (
setRulesetmethod) and call it a day.But, in the second case I use
migrateRulesetfrom@stoplight/spectral-ruleset-migratorwhich, if I assume correctly, ensures some compatibility (which is awesome) and deals with different file formats (also awesome). But, it returns a javascript file, and this is pain in the neck. I either have to useeval()to deal with the file or some other black magic.Is there a recommended way to deal with that I have multiple sources of rulesets and they have to be loaded into Spectral?
Thanks for any help!
Beta Was this translation helpful? Give feedback.
All reactions