question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Alphabetical and '@key'

See original GitHub issue

Describe the bug

I may be doing it wrong, but the alphabetical function doesn’t appear to work with '@key'. Here’s the rule I’m trying to create:

  response-order:
    message: Responses should be in alphabetical order
    recommended: true
    given: $.paths.*.*
    then:
      field: responses
      function: alphabetical
      functionOptions:
        keyedBy: '@key'

I’ve also tried this form:

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

To Reproduce

Given this OpenAPI document

openapi: 3.0.2
info:
  title: Test Spec
  version: 0.0.0
paths:
  /foo:
    get:
      operationId: get-foo
      responses:
        '400':
          description: ''
        '200':
          description: ''

Run this CLI command

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

Expected behavior

The lint output should contain the following:

 9:17  warning  response-order    Responses should be in alphabetical order

Environment

  • Library version: 4.2.0
  • OS: Windows 10

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
P0lipcommented, Dec 5, 2019

@dillonredding soon! hopefully next week or in 2 weeks 😃 Def before the end of year.

1reaction
P0lipcommented, Dec 4, 2019

@dillonredding Just wanted to give you heads up that this particular issue is going to be resolved in the next release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Alphabetic Keys | Shortcut Matters - WordPress.com
Alphabetic Keys : These are keys that have alphabets on them, ranging from A to Z. Punctuation Keys: These are keys of the...
Read more >
Alphabet Key Letter Vector Images (over 4,100) - VectorStock
The best selection of Royalty Free Alphabet Key Letter Vector Art, Graphics and Stock Illustrations. Download 4100+ Royalty Free Alphabet Key Letter Vector ......
Read more >
How many Alphabet Keys in Keyboard? - BYJU'S Exam Prep
The keyboard has 26 alphabets keys which are used to type sentences or words on a computer system in both capital and small...
Read more >
Keyboard with alphabetical key organization and method of use
A keyboard adaptable for any type of a computer or other electronic device uses an alphabetical lettering arrangement that id divided into ...
Read more >
Sort dictionary alphabetically when the key is a string (name)
simple algorithm to sort dictonary keys in alphabetical order, First sort the keys using sorted sortednames=sorted(dictUsers.keys(), ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found