swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

Incorrect order of properties in array

Open VSuchanek opened this issue 2 years ago • 0 comments

Hello,

I have found an incorrectly rendered part in component schema body:

image

The order of properties is problematic. If properties are specified outside of array then the order of properties is reversed. According to OpenAPI specification there should be in the "prop1" "string($jObject)" first, "Description - correct position" second, "Description - incorrect position" third and "nullable: true" the last.

Expected result: Keep an order with OpenAPI definition.

Example Swagger/OpenAPI definition:

{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Sample"
  },
  "paths": {
    "/path/v1/": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SchemaName"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "success"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "SchemaName": {
        "type": "object",
        "properties": {
          "prop1": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "jObject",
              "description": "Description - correct position"
            },
            "description": "Description - incorrect position",
            "nullable": true
          },
          "prop2": {
            "type": "string",
            "nullable": true
          }
        }
      }
    }
  }
}

Best Regards, Vaclav

VSuchanek avatar Feb 21 '22 10:02 VSuchanek