Yaml 另一个文件中的Swagger架构引用
当我设计我的swagger API服务模型和强调文本时,我正在处理巨大的yaml模式。我想将Yaml 另一个文件中的Swagger架构引用,yaml,swagger,Yaml,Swagger,当我设计我的swagger API服务模型和强调文本时,我正在处理巨大的yaml模式。我想将模型部分保存在另一个文件中,以便具有更大的灵活性和可实现性 在以下文档中,我使用了这部分代码: components: schemas: Request: title: Request type: object properties: technicalData: $ref: '../../schemas/foo.yaml
模型
部分保存在另一个文件中,以便具有更大的灵活性和可实现性
在以下文档中,我使用了这部分代码:
components:
schemas:
Request:
title: Request
type: object
properties:
technicalData:
$ref: '../../schemas/foo.yaml/components/schemas/TechnicalData'
在我的foo.yaml
文件中,我有如下内容:
components:
schemas:
TechnicalData:
type: object
properties:
application:
type: string
applicationCode:
type: string
userId:
type: string
它在localhost上工作,但在enterprise Deployment服务器上运行我的文件时会遇到以下问题:
错误
解析程序错误位于
组件.schemas.Request.properties.technicalData.$ref无法
解析引用,因为:不可接受
我成功地在本地通过浏览器浏览了我的文件
在互联网上查看时,我发现了一些与我的主题相关的问题,但不幸的是,这些问题不是很有用:
在文件名和/components/…
之间添加#
:
$ref:“../../schemas/foo.yaml#/components/schemas/TechnicalData”
^
就这么简单。我一直在等待部署,以验证它在服务器上的工作情况