【问题标题】:include yaml file as a reference in another yaml file swagger在另一个 yaml 文件中包含 yaml 文件作为参考
【发布时间】:2017-05-19 15:03:31
【问题描述】:

我想在我的主 yaml 文件中包含一个 yaml 文件,我使用了 ref 关键字,但那个不起作用,下面是我的 yaml

主 yaml 文件

---
swagger: "2.0"
info:
  $ref: /another.yaml

  version: "1"
  title: "test"
host: "localhost.com:8080"
basePath: "/test"

另一个.yaml

description: >
    ## test
      This is test

当我运行它时,这两个文件都在同一个目录中,我在 swagger ui 中看不到 another.yaml 内容。我该如何实现这一点,或者是否有任何节点模块可以实现这一点。

【问题讨论】:

    标签: node.js yaml swagger swagger-ui


    【解决方案1】:

    info 对象不支持引用。唯一支持$ref 的对象是:

    • schema
    • 路径项
    • 操作参数和路径参数
    • responses 部分中的个人回复

    如有疑问,请参阅specification

    【讨论】:

    • 如何在基本 yaml 文件中包含描述?
    猜你喜欢
    • 2010-10-06
    • 2011-01-17
    • 1970-01-01
    • 1970-01-01
    • 2021-08-20
    • 2018-11-27
    • 1970-01-01
    • 2019-03-11
    • 2018-08-09
    相关资源
    最近更新 更多