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

Improve Ruleset validation #1637

Closed
mnaumanali94 opened this issue May 25, 2021 · 0 comments · Fixed by #1672
Closed

Improve Ruleset validation #1637

mnaumanali94 opened this issue May 25, 2021 · 0 comments · Fixed by #1672
Assignees

Comments

@mnaumanali94
Copy link
Contributor

mnaumanali94 commented May 25, 2021

To Reproduce

Use .spectral.yml:

extends: 'spectral:oas'
rules:
  se_oas3_components_must_exist:
    type: style
    given: $
    formats:
      - oas3
    message: '{{error}}'
    then:
      field: components
      function: schema
      functionOptions:
        type: object
        minItems: 1

Look at validations for spectral file.

Expected Results

I would expect one error relating to the lack of a schema object under functionOptions.

Actual Results

image

This made fixing a simple problem a goose chase. The CLI at least returns the actual error, though a ton of extra garbage:

$ spectral lint -r ~/Downloads/se-spectral.yml ~/Documents/Stoplight\ Studio/test/test.v1.json
/rules/se_oas3_components_must_exist/then/functionOptions should NOT have additional properties
/rules/se_oas3_components_must_exist/then/functionOptions should have required property 'schema'
/rules/se_oas3_components_must_exist/then should match "then" schema
/rules/se_oas3_components_must_exist/then should be array
/rules/se_oas3_components_must_exist/then should match some schema in anyOf
/rules/se_oas3_components_must_exist should be string
/rules/se_oas3_components_must_exist should be equal to one of the allowed values
/rules/se_oas3_components_must_exist should be boolean
/rules/se_oas3_components_must_exist should be array
/rules/se_oas3_components_must_exist should match exactly one schema in oneOf

Expected

Improve the ruleset validation to show better errors for spectral rulesets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants