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

Incorrect line number when semicolons are present in a key #1697

Closed
khband opened this issue Jun 28, 2021 · 2 comments · Fixed by #1703
Closed

Incorrect line number when semicolons are present in a key #1697

khband opened this issue Jun 28, 2021 · 2 comments · Fixed by #1703
Assignees
Labels
p/medium released t/bug Something isn't working

Comments

@khband
Copy link

khband commented Jun 28, 2021

Describe the bug

The displayed line number for errors are always set to the line previous to one containing a semicolon in the key.

To Reproduce

Ruleset

rules:
  therule:
    description: schema type is array
    given: "$.paths[*].[*].responses[*].content[*].schema.type"
    then:
      function: pattern
      functionOptions:
        match: "array"

Document:

openapi: 3.0.3
paths:
  /customer:
    get:
      responses:
        "200":
          content: # recieves error on this line
            application/json;charset=utf-8: # semicolon causes the problem
              schema:
                type: string # expecting error on this line

Expected behavior

Error should be on line 10 (type).

Actual behavior

Error shows up on line 7 (content), right before the key including a semicolon.

Environment (remove any that are not applicable):

  • Library version: 5.9.1

Additional comments

We have tried enclosing the key in double quotations which gave no difference in result.

@P0lip
Copy link
Contributor

P0lip commented Jun 30, 2021

Hey!
Yup, it's indeed an error on the Spectral side. Will fix.

@stoplight-bot
Copy link
Collaborator

🎉 This issue has been resolved in version @stoplight/spectral-core-v1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p/medium released t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants