Swagger 如何引用与属性相同的架构?
我的oas.yaml文件中有以下内容:Swagger 如何引用与属性相同的架构?,swagger,openapi,swagger-editor,Swagger,Openapi,Swagger Editor,我的oas.yaml文件中有以下内容: components: schemas: ServiceError: type: object properties: Message: type: string description: "The exception message." ExceptionMessage: type: string Type:
components:
schemas:
ServiceError:
type: object
properties:
Message:
type: string
description: "The exception message."
ExceptionMessage:
type: string
Type:
type: string
description: "The exception type.""
InnerError:
$ref: '#/components/schemas/ServiceError'
description: "If there's an inner exception, the InnerException.
Property:
type: object
properties:
Name:
type: string
description: Name of the property.
它不喜欢行“description:”如果存在内部异常,则为“InnerException”。如果我删除该行,它也不喜欢行“Property:”。我尝试了很多东西,但都没有效果。我不明白什么?- 不允许在
处使用$ref
说明。请参阅
- 在InnerError之前有两个''。不确定这是否只是一个复制粘贴错误
上不允许使用$ref
说明。看
- InnerError之前的
是两个'。不确定这是否只是一个复制粘贴错误innerError
servicererror
本身可以有描述
。显示了使用allOf
的解决方法。如果不允许任何描述,如何在生成的代码中获取该属性的注释?感谢servicererror
本身可以有一个说明
。使用allOf
显示了一个解决方法。它不喜欢InnerError.description
,因为里面没有结束引号。正如Martin所说,在Type.description
的末尾有一个额外的引号。您需要修复引号。它不喜欢InnerError.description因为里面没有结束引号。正如Martin所说,在Type.description
的末尾有一个额外的引号。你需要修正引号。