openapispectral

How to solve "error #1: Invalid ruleset provided" when using Spectral to lint an OpenAPI YAML file


I am trying to lint an OpenAPI YAML file using Stoplight Spectral, and following the instructions provided here I get the error "error #1: Invalid ruleset provided" but not any other details.


Solution

  • This step:

    echo 'extends: ["spectral:oas", "spectral:asyncapi"]' > .spectral.yaml
    

    encloses the contents in quotes in the generated .spectral.yaml file, which causes the error. Removing the quotes will leave the value as:

    extends: ["spectral:oas", "spectral:asyncapi"]
    

    which is then understood by Spectral and eliminates the cause of the error.

    NOTE: this is one of many possible error causes, rulesets themselves might have other internal issues.