Skip to content

Include array responses in http_codes? #323

Open
@penso

Description

@penso

Hi everyone,

I found the is_array in the desc parameter for an API endpoint to specify an array as response. But I didn't find how to specify that in the http_codes part, something like:

          desc "List All Delivery",
            is_array: true,
            entity: ::Delivery::Entity,
            http_codes: [
              [200, 'OK', ::Delivery::Entity],
              [401, 'Unauthorized', API::Entities::Error],
              [403, 'Forbidden', API::Entities::Error]
          ]
          get do
            present(paginate(::Delivery.all),
                    with: ::Delivery::Entity)
          end

The generated Swagger documentation is my code makes you think the 200 response will give you a Hash but it won't, it's an array. Is there a way to do that?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions