Apipie/apipie-rails

Returns is not according to json response

omerpucit opened this issue · 1 comments

returns code: :ok do
  property :blogs, Array do
    property :id, :number
    property :title, String
    property :description, String
  end
end

http://localhost:3000/apipie/1.0/blogs/index.html
The JSON response should be equivalent to

{ 'blogs': [ { 'id': 1, 'title': 'test', 'description': 'this is description' }, { 'id': 2, 'title': 'test 1', 'description': 'this is description1' }] }

But currently, it is showing in the wrong way.

{ 'blogs': [ { 'blogs': { 'id': 1, 'title': 'test', 'description': 'this is description' } }, { 'blogs': { 'id': 2, 'title': 'test 1', 'description': 'this is description1' } }] }

So anyone please suggest how it should be resolve.

Please have a look at the attached screenshot.

Current behavior:

current_response

Required:

required_response

Thanks.

Fixed it using this way.

def_param_group :blogs
  property :id, :number
  property :title, String
  property :description, String
end

returns :param_group => :blogs, :code => :ok