xiaoymin / knife4j

Knife4j is a set of Swagger2 and OpenAPI3 All-in-one enhancement solution
https://doc.xiaominfo.com
Apache License 2.0
4.15k stars 622 forks source link

响应参数及响应实例中不能正确展示 $ref 的值 #757

Open 0xheider opened 8 months ago

0xheider commented 8 months ago
  "openapi": "3.0.1",
  "info": {
    "title": "opex-web",
    "description": "运营工作台接口",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "http://127.0.0.1:10010",
      "description": "Generated server url"
    }
  ],
  "paths": {
    "/demo/detail": {
      "get": {
        "tags": [
          "活动相关接口"
        ],
        "summary": "根据 id 获取记录",
        "description": "根据 id 获取记录,带包装体结构",
        "operationId": "getById",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "主键 id",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "description": "响应码",
                      "format": "int32",
                      "default": 10000
                    },
                    "message": {
                      "type": "string",
                      "description": "响应消息",
                      "default": "操作成功"
                    },
                    "data": {
                      "$ref": "#/components/schemas/OpexDemoResp"
                    },
                    "success": {
                      "type": "boolean",
                      "description": "是否成功"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "OpexDemoResp": {
      "type": "object",
      "properties": {
        "bizCode": {
          "type": "string",
          "description": "业务单号",
          "refType": null
        },
        "orderId": {
          "type": "string",
          "description": "订单号",
          "refType": null
        },
        "orderStatus": {
          "type": "string",
          "description": "订单状态",
          "refType": null
        },
        "createAt": {
          "type": "string",
          "description": "创建时间",
          "format": "date-time",
          "refType": null
        },
        "createAccount": {
          "type": "string",
          "description": "创建人账户",
          "refType": null
        },
        "updateAt": {
          "type": "string",
          "description": "更新时间",
          "format": "date-time",
          "refType": null
        },
        "updateAccount": {
          "type": "string",
          "description": "更新人账户",
          "refType": null
        }
      },
      "description": "测试vo响应对象"
    }
  }
}

实际展示如下:

image

期望展示:

image

版本:

com.github.xiaoymin knife4j-openapi3-spring-boot-starter 4.3.0
AnyFork commented 7 months ago

我也遇到了相同的问题,解决了吗?

denglei0712 commented 6 months ago

4.5.0也出现了这个问题