-
Notifications
You must be signed in to change notification settings - Fork 477
Open
Labels
Description
Related issue: ruby-grape/grape-entity#252
As for example above, we want request body to be:
{
"accounts": [
{
"cma": 0,
"name": "string",
"environment": "string",
"sites": 0,
"username": "string",
"password": "string"
}
]
}But actually:
[
{
"cma": 0,
"name": "string",
"environment": "string",
"sites": 0,
"username": "string",
"password": "string"
}
]Grape also wants the array to be in the key of top level JSON object.
( Top level array data cannot be handled by Grape out of the box ( cf. ruby-grape/grape#1730 ). )
So it seems the generated specification is broken.
A workaround is to adding dummy optional parameter.
It forces the request body to be a JSON object.
I've found that making MoveParams#build_definition to always use object_type fixes the issue.
Is this reasonable fix?
jozarz, stylergergely and swistaczek