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

Alphabetical Ignored When a $ref Exists #979

Closed
raworre opened this issue Feb 20, 2020 · 2 comments · Fixed by #1008
Closed

Alphabetical Ignored When a $ref Exists #979

raworre opened this issue Feb 20, 2020 · 2 comments · Fixed by #1008
Assignees
Labels
t/bug Something isn't working

Comments

@raworre
Copy link

raworre commented Feb 20, 2020

Alphabetical Ignored When a $ref Exists

I noticed an issue with getting the alphabetical function to work. It seems when a $ref exists in the items to be checked for alphabetization the rule is ignored.

To Reproduce

Using the rules taken directly from this test scenario and a modified version of the OpenAPI document in the same test we are not seeing the failed rule as we should.

my-rules.yaml:

rules:
  response-order:
    message: Responses should be in alphabetical order
    recommended: true
    given: $.paths.*.*.responses
    then:
      function: alphabetical

test-spec.yaml:

openapi: 3.0.2
info:
  title: Test Spec
  version: 0.0.0
paths:
  /foo:
    get:
      operationId: get-foo
      responses:
        '404':
          description: ''
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/foo'
components:
  schemas:
    foo:
      title: More incorrect casing
      type: object
      properties:
        id:
          type: integer
        bar:
          type: string

CLI command:

spectral lint test-spec.yaml -r my-rules.yaml

We should see the following in our results:

 19:15  warning  response-order  Responses should be in alphabetical order

Environment

  • Library version: 5.0.0
  • OS: Windows 10
  • Node version: 12.14.1
@raworre raworre added the t/bug Something isn't working label Feb 20, 2020
@dillonredding
Copy link

Any updates or movement on this?

@P0lip
Copy link
Contributor

P0lip commented Mar 11, 2020

@raworre @dillonredding my apologies for dropping a ball.
I'm on the case now.

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

Successfully merging a pull request may close this issue.

3 participants