elements icon indicating copy to clipboard operation
elements copied to clipboard

The order of oneOf-objects in allOff-array is reversed.

Open dingyaguang117 opened this issue 4 years ago • 0 comments

Summary

When there are oneOf-objects in allOff-array, the order is reversed.

image

Tasks

  • [ ] The order of oneOf-objects should be not be reversed.
  • [ ] The position of oneOf-objects should be not always be at the bottom.

Thanks very much.

The source code:

{
  "openapi": "3.1.0",
  "info": {
    "title": "demo",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "http://localhost:3000"
    }
  ],
  "paths": {
    "/user": {
      "post": {
        "summary": "Create New User",
        "operationId": "post-user",
        "description": "Create a new user.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/Name-Common"
                      },
                      {
                        "$ref": "#/components/schemas/Name-Simple"
                      }
                    ]
                  },
                  {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/Address-Common"
                      },
                      {
                        "$ref": "#/components/schemas/Address-Singapore"
                      }
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "gendor": {
                        "type": "string"
                      },
                      "birthday": {
                        "type": "string"
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Name-Common": {
        "title": "Name-Common",
        "type": "object",
        "properties": {
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          }
        }
      },
      "Name-Simple": {
        "title": "Name-Simple",
        "type": "object",
        "properties": {
          "full_name": {
            "type": "string"
          }
        }
      },
      "Address-Common": {
        "title": "Address-Common",
        "type": "object",
        "properties": {
          "state": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        }
      },
      "Address-Singapore": {
        "title": "Address-Singapore",
        "type": "object",
        "properties": {
          "detail": {
            "type": "string"
          }
        }
      }
    }
  }
}

dingyaguang117 avatar Dec 27 '21 02:12 dingyaguang117