Sha256: 9bcded1faf248faf0654e497e8f3756d6f1a6da5902b8ad411eff4a42768fb41

Contents?: true

Size: 1.13 KB

Versions: 12

Compression:

Stored size: 1.13 KB

Contents

class V1::GoodsDoc < BaseDoc
  api :index, 'GET list of goods.' do
    desc 'listing goods',
         view!: 'search view, allows:<br/>',
               # '1/ all goods (default):all<br/>' \
               # '2/ only online:online<br/>' \
               # '3/ only offline:offline<br/>' \
               # '4/ expensive goods:expensive<br/>' \
               # '5/ cheap goods:cheap<br/>',
         search_type!: 'search field, allows:<br/>'
               # '1/ name<br/>2/ creator,<br/>3/ category<br/>4/ price<br/>'

    # Instead of:
    # query :view,        String, enum: %w[ all online offline expensive cheap ]
    query :view, String, enum!: {
        'all goods (default)': :all,
                'only online': :online,
               'only offline': :offline,
            'expensive goods': :expensive,
                'cheap goods': :cheap
    }
    query :search_type, String, enum: %w[ name creator category price ]
    # Same as:
    # query :search_type, String, desc!: 'search field, allows:<br/>',
    #       enum: %w[ name creator category price ]

    # TODO: Support `desc: '', auto_desc: true or %i[ enum must_be ]`
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
zero-rails_openapi-1.7.0 documentation/examples/auto_gen_desc.rb
zero-rails_openapi-1.6.1 documentation/examples/auto_gen_desc.rb
zero-rails_openapi-1.6.0 documentation/examples/auto_gen_desc.rb
zero-rails_openapi-1.5.9 documentation/examples/auto_gen_desc.rb
zero-rails_openapi-1.5.8 documentation/examples/auto_gen_desc.rb
zero-rails_openapi-1.5.7 documentation/examples/auto_gen_desc.rb
zero-rails_openapi-1.5.6 documentation/examples/auto_gen_desc.rb
zero-rails_openapi-1.5.5 documentation/examples/auto_gen_desc.rb
zero-rails_openapi-1.5.4 documentation/examples/auto_gen_desc.rb
zero-rails_openapi-1.5.3 documentation/examples/auto_gen_desc.rb
zero-rails_openapi-1.5.2 documentation/examples/auto_gen_desc.rb
zero-rails_openapi-1.5.1 documentation/examples/auto_gen_desc.rb