Skip to content

Wrong Order #3032

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

Closed
1Map opened this issue May 5, 2017 · 1 comment
Closed

Wrong Order #3032

1Map opened this issue May 5, 2017 · 1 comment

Comments

@1Map
Copy link

1Map commented May 5, 2017

By looking at the screenshot below you will find that the order of the properties are wrong (Top right in screenshot). I find that it only happens if the model have more than 8 properties:

image

The YAML to test on http://editor.swagger.io is:

swagger: '2.0'
info:
  description: ''
  version: 1.0.0
  title: my API
basePath: /api/v1
tags:
  - name: params
    description: Parameters
paths:
  /params/layer:
    get:
      tags:
        - params
      summary: ''
      description: ''
      operationId: layer
      produces:
        - application/json
      parameters:
        - name: layerId
          in: query
          required: false
          type: integer
          format: int64
      responses:
        '200':
          description: successful operation
          schema:
            $ref: '#/definitions/Layer'
      security:
        - token: []
securityDefinitions:
  token:
    type: apiKey
    name: token
    in: query
definitions:
  Layer:
    type: object
    properties:
      layerId:
        type: integer
        format: int64
      layerType:
        type: string
      layerCaption:
        type: string
      layerDescription:
        type: string
      primaryField:
        type: string
      searchCaption:
        type: string
      isBaseLayer:
        type: boolean
      visibility:
        type: boolean
      opacity:
        type: number
        format: float
      minScale:
        type: integer
        format: int32
      maxScale:
        type: integer
        format: int32
      layerOrder:
        type: integer
        format: int32
      layerGroup:
        type: string
@webron
Copy link
Contributor

webron commented May 5, 2017

First - thank you for opening the ticket here and not in swagger-editor. Makes our management easier :)

There's a technical issue here - objects do not really have ordered properties, so guaranteeing that the order is kept is theoretically out of scope. In practice, most modern parsers tend to keep ordering, so it makes it easier to control. Odd case that it changes based on the number of entries.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants