我正在记录一个名为/findGuild
的方法的公共API,该方法采用强制key
参数和以下参数之一:
byPlayer
byName
必须拥有byPlayer
或byName
;我的问题是:如何表明byPlayer
和byName
是互斥的,但有一个是强制性的?
现在,我的.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
}
答案 0 :(得分:1)
我担心(但不完全确定)API Blueprint目前无法表达这种关系。
我可以肯定地告诉您,根据public roadmap,URI参数将替换为MSON object,它支持您要求的scenario。
希望它有所帮助!