Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
0xheider opened this issue Mar 25, 2024 · 2 comments
Open

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

0xheider opened this issue Mar 25, 2024 · 2 comments

Comments

@0xheider
Copy link

0xheider commented Mar 25, 2024

  "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
Copy link

AnyFork commented Apr 18, 2024

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

@denglei0712
Copy link

4.5.0也出现了这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants