Open
Description
I hit a bug when trying to use this param declaration:
params do
requires :tags, type: Array[String], documentation: { in: 'body' }
end
Expecting this to create a schema and tag it on the request, it actually did a formData
instead:
{
"in": "formData",
"name": "tags",
"type": "array",
"items": {
"type": "string"
},
"required": true
}
I've been using this successfully everywhere else so this threw me off. I experimented and realized that the requires
with Array[String]
does not work if it's the only one. It immediately works when you add a non array/string param:
params do
requires :tags, type: Array[String], documentation: { in: 'body' }
requires :lol, documentation: { in: 'body' }
end
Results in:
{
"name": "V1PostMortemsReportsReportIdTags",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/putV1PostMortemsReportsReportIdTags"
}
}
And the schema:
{
"type": "object",
"properties": {
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"lol": {
"type": "string"
}
},
"required": [
"tags",
"lol"
],
"description": "Add tags to a report"
}
What's also peculiar is that if you add multiple Array[String]
to params it maintains the same bug, I've only been able to get to work the moment you add a non-array param.