Skip to content

How can I maintain the order of attributes from the spec (instead of getting them in alphabetical order)? #1264

Closed Answered by ernado
tihomirbz-elwood asked this question in Q&A
Discussion options

You must be logged in to vote

Actually ogen should keep original order.
For example, following schema:

openapi: 3.0.3
info:
  title: API
  version: 0.1.0
paths:
  /objects/:
    get:
      operationId: listObjects
      responses:
        default: {$ref: '#/components/responses/Error'}
        '200':
          description: List of clusters
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Object'
components:
  schemas:
    Object:
      type: object
      required:
        - id
        - name
        - foo
        - bar
      properties:
        id:
          type: string
          format: uuid
        n…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by tihomirbz-elwood
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants