I have been looking at the RAML spec trying to find how to represent a form parameter that can contain multiple values (like say "choices: [choice1, choice2, choice3]"). There's a "repeat" attribute in the spec, which is supposed to allow you to reuse a parameter name in a "post" definition (or any other http methods that accept request attributes), but the RAML api-designer (as of 06/08/2015) does not recognize "repeat" and flags it as an error. Has anyone found a way around this?
Example
Expected resource
{choices : ["Choice 1 rocks", "Choice 2 rocks"]}
This fails
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!
This circumvents the problem if you choose to split the parameters
{
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!
In the first spec above, it does not make sense to have
choices
twice in theformParameters
section. It's the same parameter: it must be listed only once, withrepeat: true
to mark it as a repeated parameter.