【问题标题】:How to define ApiBlueprint array values example with MSON?如何使用 SON 定义 Api Blueprint 数组值示例?
【发布时间】:2017-11-08 13:04:31
【问题描述】:

我可以使用 MSON 来指定示例值而不是 + Body 吗? 是否可以覆盖预定义的结构值?

我试过这样:

+ Request (application/json)

    + Headers

            Authorization: JWT <token>    
    + Attributes (ClientsideCommand)
        + alias: `show-xc`
        + args (array[AppCommandArg], fixed-type)
            + (AppCommandArg)
                + arg_key: address
                + order: 1
                + required: true
                + skip_arg_name: true
            + (AppCommandArg)
                + arg_key: `-A1`
                + order: 2
                + required: true
                + skip_arg_name: false

但是这样的定义破坏了 json-schema,因为 AppCommandArg 被描述为单独的对象。 而且在从 MSON 生成的 JSON 中有 3 项,其中第一项是默认的 AppCommandArg

【问题讨论】:

    标签: jsonschema apiblueprint mson


    【解决方案1】:

    看起来不可能把这件事合二为一。如果您添加元素,如上所示,Apiary 会按照它看到的方式呈现它,如果一个元素被两次记录,那么 json 架构也会对其进行两次描述。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-08
      相关资源
      最近更新 更多