【问题标题】:Documenting Mutually Exclusive Query Parameters in API Blueprint在 API 蓝图中记录互斥查询参数
【发布时间】:2016-01-31 04:26:00
【问题描述】:

我正在记录一个公共 API,该 API 有一个名为 /findGuild 的方法,该方法采用强制性 key 参数和以下参数之一:

  1. byPlayer
  2. byName

必须byPlayerbyName;我的问题是:我如何表明byPlayerbyName 是互斥的,但必须有一个?


现在,我的.apib 中有以下资源:

### GET /findGuild{?byName,byPlayer,key}

+ Parameters
  + byName: `YourGuild` (string, optional) - Search for the Guild by its name.
  + byPlayer: (string, optional) -  Search for Guild by a player. Does not seem to work.
  + key: `ffffffff-ffff-ffff-ffff-ffffffffffff` (string, required) - The user's API key.

+ Response 200 (application/json)

    + Attributes (object)
      + guild (string) - The guild id or null.
      + success (boolean) - Should be true.

    + Body

            {
              "guild": "ffffffffffffffffffffffff",
              "success": true
            }

【问题讨论】:

    标签: apiblueprint


    【解决方案1】:

    恐怕(但不完全确定)API Blueprint 目前无法表达这种关系。

    我可以肯定地告诉你的是,根据public roadmap,URI 参数将被替换为MSON object,它支持你要求的scenario

    希望对你有帮助!

    【讨论】:

    • 感谢您的澄清,所以我现在能做的最好的就是用简单的英语解释。我期待着这些变化!
    猜你喜欢
    • 1970-01-01
    • 2014-02-03
    • 1970-01-01
    • 2014-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多