Closed
Description
Hi,
I have the following entities:
module Entity
class Account < Grape::Entity
expose :cma, documentation: { type: Integer, desc: 'Company number', param_type: 'body'}
expose :name, documentation: { type: String, desc: 'Company Name' }
expose :environment, documentation: { type: String, desc: 'Test Environment' }
expose :sites, documentation: { type: Integer, desc: 'Amount of sites' }
expose :username, documentation: { type: String, desc: 'Username for Dashboard' }
expose :password, documentation: { type: String, desc: 'Password for Dashboard' }
end
class Accounts < Grape::Entity
expose :accounts, documentation: { type: Entity::Account, is_array: true, param_type: 'body', required: true }
end
end # module Entity
and use it as follows in my endpoint:
module Api
class Accounts < Grape::API
desc 'createTestAccount',
params: Entity::Accounts.documentation
post 'create' do
JSON(params)
end
end
end
But when I generate the swagger documentation for it i still get param_type formData:
What do I need to change that I get the following JSON in the model / example swagger:
{
"accounts": [
{
"cma": 0,
"name": "string",
"environment": "string",
"sites": 0,
"username": "string",
"password": "string"
}
]
}
When I omit is_array: true
I'm able to get the proper nesting and param_type body, but of course the array is missing then...
Any suggestions are appreciated.
Metadata
Metadata
Assignees
Labels
No labels