Skip to content

Swagger 2.0 to OpenAPI3 yaml: Array object become object #93

@moemoequte

Description

@moemoequte
    "/core/service/user/info/query": {
      "post": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "schemes": [
          "https"
        ],
        "tags": [
          ""
        ],
        "summary": "UserAllInfoQueryHandler 用户所有信息查询接口",
        "parameters": [
          {
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "user_id": {
                  "type": "string"
                }
              }
            }
          }
        ],
        "responses": {
          "default": {
            "description": "",
            "schema": {
              "type": "object",
              "properties": {
                "code": {
                  "description": "状态码",
                  "type": "integer"
                },
                "message": {
                  "description": "消息",
                  "type": "string"
                },
                "result": {
                  "description": "返回的详情",
                  "type": "object",
                  "properties": {
                    "address": {
                      "type": "string"
                    },
                    "birthday": {
                      "type": "string"
                    },
                    "date_joined": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "gender": {
                      "type": "integer"
                    },
                    "huawei_health": {
                      "type": "integer"
                    },
                    "huawei_openid": {
                      "type": "string"
                    },
                    "identity": {
                      "type": "string"
                    },
                    "identity_end_date": {
                      "type": "string"
                    },
                    "identity_issue": {
                      "type": "string"
                    },
                    "identity_start_date": {
                      "type": "string"
                    },
                    "info_id": {
                      "type": "string"
                    },
                    "is_active": {
                      "type": "integer"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "creator": {
                            "type": "string"
                          },
                          "end_date": {
                            "description": "结束时间",
                            "type": "string"
                          },
                          "item_code": {
                            "description": "属性代码",
                            "type": "string"
                          },
                          "item_id": {
                            "description": "属性唯一标识",
                            "type": "string"
                          },
                          "item_value": {
                            "description": "属性值",
                            "type": "string"
                          },
                          "start_date": {
                            "description": "开始时间",
                            "type": "string"
                          },
                          "update_date": {
                            "type": "string"
                          },
                          "updater": {
                            "type": "string"
                          },
                          "user_id": {
                            "type": "string"
                          }
                        }
                      },
                      "properties": {
                        "creator": {
                          "type": "string"
                        },
                        "end_date": {
                          "description": "结束时间",
                          "type": "string"
                        },
                        "item_code": {
                          "description": "属性代码",
                          "type": "string"
                        },
                        "item_id": {
                          "description": "属性唯一标识",
                          "type": "string"
                        },
                        "item_value": {
                          "description": "属性值",
                          "type": "string"
                        },
                        "start_date": {
                          "description": "开始时间",
                          "type": "string"
                        },
                        "update_date": {
                          "type": "string"
                        },
                        "updater": {
                          "type": "string"
                        },
                        "user_id": {
                          "type": "string"
                        }
                      }
                    },
                    "last_login": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "nationality": {
                      "type": "integer"
                    },
                    "nickname": {
                      "type": "string"
                    },
                    "phone": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "update_date": {
                      "type": "string"
                    },
                    "user_id": {
                      "type": "string"
                    },
                    "username": {
                      "type": "string"
                    },
                    "wechat_app_openid": {
                      "type": "string"
                    },
                    "wechat_unionid": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
  /core/service/user/info/query:
    post:
      tags:
      - ""
      summary: UserAllInfoQueryHandler 用户所有信息查询接口
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                user_id:
                  type: string
        required: true
      responses:
        default:
          description: ""
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    description: 状态码
                  message:
                    type: string
                    description: 消息
                  result:
                    type: object
                    properties:
                      address:
                        type: string
                      birthday:
                        type: string
                      date_joined:
                        type: string
                      email:
                        type: string
                      gender:
                        type: integer
                      huawei_health:
                        type: integer
                      huawei_openid:
                        type: string
                      identity:
                        type: string
                      identity_end_date:
                        type: string
                      identity_issue:
                        type: string
                      identity_start_date:
                        type: string
                      info_id:
                        type: string
                      is_active:
                        type: integer
                      items:
                        type: object
                        properties:
                          creator:
                            type: string
                          end_date:
                            type: string
                            description: 结束时间
                          item_code:
                            type: string
                            description: 属性代码
                          item_id:
                            type: string
                            description: 属性唯一标识
                          item_value:
                            type: string
                            description: 属性值
                          start_date:
                            type: string
                            description: 开始时间
                          update_date:
                            type: string
                          updater:
                            type: string
                          user_id:
                            type: string
                      last_login:
                        type: string
                      name:
                        type: string
                      nationality:
                        type: integer
                      nickname:
                        type: string
                      phone:
                        type: string
                      source:
                        type: string
                      update_date:
                        type: string
                      user_id:
                        type: string
                      username:
                        type: string
                      wechat_app_openid:
                        type: string
                      wechat_unionid:
                        type: string
                    description: 返回的详情

as you can see, the definition in swagger 2 are as follow

                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",

but convert to openapi3 yaml, the items property become object not array of object

                      items:
                        type: object
                        properties:
                          creator:
                            type: string

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions