如何从另一个 OpenAPI 文件导入组件?

xtr*_*tra 2 swagger openapi

您可以导入在其他 OpenAPI 文件中定义的组件吗?
假设我有两个 openAPI 文件: openAPI.yamlotherOpenAPI.yaml. 我openAPI.yml想使用myItem中定义的组件otherOpenAPI.yaml

我可以做一些类似的事情吗: $ref: './otherOpenAPI.yaml/components/myItem

小智 5

您可以使用:

$ref: './otherOpenApi.yaml#/components/MyItem'