我一直在寻找RAML规范试图找到如何表示一个可以包含多个值的表单参数(如说“选择:[choice1,choice2,choice3]”)。规范中有一个“repeat”属性,它可以让你在“post”定义中重用参数名称(或任何其他接受请求属性的http方法),但RAML API设计器(截至06/08/2015)不识别“重复”并将其标记为错误。有没有人找到解决这个问题的方法?RAML多值表单参数
例
预计资源
{choices : ["Choice 1 rocks", "Choice 2 rocks"]}
这种失败
post:
description: create a resource
body:
application/x-www-form-urlencoded:
formParameters:
choices:
displayName: Choice 1
description: first choice
type: string
required: true
repeat: true
example: Choice 1 rocks!
choices:
displayName: Choice 2
description: second choice
type: string
required: true
repeat: true
example: Choice 2 rocks!
如果选择拆分参数这就避免了问题
{
choice1 : "Choice 1 rocks!",
choice2 : "Choice 2 rocks!"
}
post:
description: create a resource
body:
application/x-www-form-urlencoded:
formParameters:
choice1:
displayName: Choice 1
description: first choice
type: string
required: true
example: Choice 1 rocks!
choice2:
displayName: Choice 2
description: second choice
type: string
required: true
example: Choice 2 rocks!