在API蓝图中记录互斥查询参数

时间:2016-01-31 04:26:01

标签: apiblueprint

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

  1. byPlayer
  2. byName
  3. 必须拥有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
                }
    

1 个答案:

答案 0 :(得分:1)

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

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

希望它有所帮助!