【问题标题】:Referencing a property inside a defined data structure in API Blueprint/MSON在 API Blueprint/MSON 中引用已定义数据结构内的属性
【发布时间】:2017-12-16 19:05:16
【问题描述】:

我一直在使用 API 蓝图格式来设计 API,并且从中获得了很多乐趣。当我声明我的数据结构时,我遇到了代码重用或模型重用问题。

根据声明响应时的文档,必须这样做:

例如:

+ Request 200 (application/json)

但是,当多人处理文档时,我不想指示他们使用什么返回码,因为我们已经定义了它们并且它们是数字,所以人们会忘记它们。因此,为了避免来回走动,我这样做的想法是我可以使用/引用其中一个属性:

# Data Structures

## HttpCode (object)
+ success: 200 - Request processed successfully
+ not_found: 404 - Content requested not found
+ forbidden: 403 - Access to content is forbidden

我会这样引用它:

+ Response (HttpCode.success) (application/json)
...

它显然不起作用,我在文档中找不到与我想做的事情有关的任何内容。也许我错过了。

那么你是怎么做到的呢?有可能吗?

谢谢!

【问题讨论】:

    标签: apiblueprint mson


    【解决方案1】:

    这是不可能的。他们在 GitHub 的代表关闭了我的问题。 https://github.com/apiaryio/api-blueprint/issues/411

    【讨论】:

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