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

documentationUrl causes #235

Open
tomereli opened this issue May 6, 2024 · 1 comment · May be fixed by #237
Open

documentationUrl causes #235

tomereli opened this issue May 6, 2024 · 1 comment · May be fixed by #237

Comments

@tomereli
Copy link

tomereli commented May 6, 2024

For support questions, please use the Stoplight Community Forum. This repository's issues are reserved for feature requests and bug reports. If you are unsure if you are experiencing a bug, the Community Forum is a great place to start.

Please delete this section, any any sections below that you don't use, before creating the issue.

Describe the bug
When adding documentationUrl to the custom spectral ruleset file, the extension breaks with error, although documentationUrl is a valid supported configuration according to https://docs.stoplight.io/docs/spectral/e5b9616d6d50c-rulesets#documentation-url

To Reproduce

Enable the extension with the following .spectral.yaml:

extends: 
  - "spectral:oas"
rules:
  # ---------------------------------------------------------------------------
  # @description: verify x-visibility is available for every operation
  # @link: https://go/apis-security-lint/x-visibility
  # ---------------------------------------------------------------------------
  x-visibility-truthy:
    documentationUrl: https://go/apis-security-lint/x-visibility
    description: x-visibility check
    message: "Make sure x-visibility is available for every operation"
    severity: "error"
    given: "$.paths.*.*"
    then:
      field: x-visibility
      function: truthy

You should see the error in the Spectral OUTPUT log.

Now remove the documentationUrl and the error is gone.

Expected behavior
When documentationUrl is set in a rule, the extension should not break, and when hovering over a warning or an error with a documentationUrl link, it should provide a clickable link to the URL defined in the .spectral.yaml file.

Screenshots
.spectral.yaml with documentationUrl (note that the openapi.json is not red - this is cause the extension broke):

image

Same .spectral.yaml without it (note that the extension output is fine, and the openapi.json file is red):

image

Environment:

  • Extension version: 1.1.2
  • VS Code version: Visual Studio Code 1.88.1
  • Operating System: MacOS Sonoma 14.4.1 (23E224)

Additional context
Add any other context about the problem here.

@ouvreboite
Copy link

Is the error still happening for you?

I'm working on adding support for documentationUrl (i.e. "click on error'scode to open the documentation site"), and I did not encoutered any runtime bug.

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