zipmark/rspec_api_documentation

Parameters for nested array

gregdymek opened this issue · 3 comments

let's say I have a structure like:

{
  data: [
    {
      id: 5,
      name: 'test'
    },
    {
      id: 6,
      name: 'test2'
    }
  ]
}

is there a way I can document the nested fields so as a result I will get openapi generated correctly (so in swagger I can add these items from the UI) ?

I was trying with something like this:

parameter :data, type: :array
parameter :id, type: :string, scope: :data
parameter :name, type: :string, scope: :data

but it didn't work

I'm facing the same issue

I guess one can use

parameter :data, type: array
parameter :id, type: integer, scope: 'data[]'

I also want a conversation about this part in #413, cause I'm facing the same issue and want to fix it in the way most users will be happy