【发布时间】:2021-09-08 11:48:05
【问题描述】:
我有这个带有嵌套引用的 OpenAPI 3.0 定义:
Student:
properties : &BaseStudent
id:
type: integer
format: int64
description: The ID of the new account.
name:
type: string
description: The human-readable description of this account.
address:
$ref : 'address.yaml#/Address'
Address:
properties :
<<* : BaseStudent
city:
type: string
description: City.
state:
type: string
description: State.
StudentMarks:
<<: *BaseStudent
makr1:
type: string
description: Mark1.
mark2:
type: string
description: Mark2.
当我在 Swagger UI 中单击请求选项卡时,它显示错误:
无法解析引用,因为:无法解析指针:/components/schemas/components/schemas/Address 在文档中不存在
实际上,Address 引用应该只是 /components/schemas/。我不知道为什么它指的是/components/schemas/components/schemas/Address。
还有其他方式来指定路径吗?
【问题讨论】:
-
您在哪个工具中看到此错误 - Swagger Editor、Codegen 或其他工具?
address.yaml文件中有什么内容? -
我在 Swagger UI 页面中看到了这个错误。我的 api 工作正常,但是当我单击请求选项卡时,我收到了这个错误。抱歉,address.yaml 打错了。我更新了它
标签: swagger-ui openapi