Skip to content

[OpenApi] How to use allOf #64648

@SpringHgui

Description

@SpringHgui

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

"RoomDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "areaId": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": "string"
          },
          "area": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AreaDto"
              }
            ]
          },
          "buildingId": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": "string"
          },
          "building": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/BuildingDto"
              }
            ]
          },
          "unitId": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": "string"
          },
          "unit": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/UnitDto"
              }
            ]
          },
          "floor": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "insideSize": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "double"
          },
          "fullSize": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "double"
          },
          "residentRooms": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/ResidentRoomDto"
            }
          },
          "remark": {
            "type": "string"
          },
          "orgId": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": "string"
          },
          "id": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": "string"
          },
          "createAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "modifyAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "createBy": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": "string"
          },
          "modifyBy": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": "string"
          }
        }
      }

Describe the solution you'd like

"RoomDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "int64"
          },
          "createAt": {
            "type": "string",
            "format": "datetime"
          },
          "modifyAt": {
            "type": "string",
            "format": "datetime"
          },
          "createBy": {
            "type": "string",
            "format": "int64"
          },
          "modifyBy": {
            "type": "string",
            "format": "int64"
          },
          "orgId": {
            "type": "string",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "areaId": {
            "type": "string",
            "format": "int64"
          },
          "area": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AreaDto"
              }
            ],
            "nullable": true
          },
          "buildingId": {
            "type": "string",
            "format": "int64"
          },
          "building": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BuildingDto"
              }
            ],
            "nullable": true
          },
          "unitId": {
            "type": "string",
            "format": "int64"
          },
          "unit": {
            "allOf": [
              {
                "$ref": "#/components/schemas/UnitDto"
              }
            ],
            "nullable": true
          },
          "floor": {
            "type": "integer",
            "format": "int32"
          },
          "insideSize": {
            "type": "number",
            "format": "double"
          },
          "fullSize": {
            "type": "number",
            "format": "double"
          },
          "residentRooms": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResidentRoomDto"
            },
            "nullable": true
          },
          "remark": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-openapi

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions