Skip to content

entity documentation support for array of entities? #66

Closed
@chebyte

Description

@chebyte

hi there I have the following grape-entites

module HQ
  module Entities
    class Client < Grape::Entity
      expose :created_by_id, documentation: {type: Integer, desc: "Created by id"}
      expose :updated_by_id, documentation: {type: Integer, desc: "Updated by id"}
      expose :first_name,    documentation: {type: String, desc: 'First Name.'}
      expose :last_name,     documentation: {type: String, desc: 'Last Name.'}
      expose :zipcode,       documentation: {type: String, desc: 'Zip Code.'}
      expose :emails, using: HQ::Entities::Email, documentation: {type: ::Item, desc: 'Emails.'}
    end
  end
end

module HQ
  module Entities
    class Email < Grape::Entity
      expose :address, documentation: {type: Integer, desc: "Email"}
    end
  end
end

the problem that I need that swagger generate the UI with the complex form I means client has many emails

      expose :emails, using: HQ::Entities::Email, documentation: {type: Array, desc: 'Emails.'}

what type I need to use? I added array but it show me just as string field like this

https://www.evernote.com/shard/s143/sh/a53f78c8-5599-4148-811f-e6b7617cd13a/419383ac0d5d9e5bac0a06278ac481da

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