Sha256: 931a4f19609799b2dace0738c895d1368c51f617b93090f5b532f73e5a908160

Contents?: true

Size: 860 Bytes

Versions: 3

Compression:

Stored size: 860 Bytes

Contents

require 'spec_helper'

describe '#542 array of type in post params' do
  let(:app) do
    Class.new(Grape::API) do
      namespace :issue_542 do
        params do
          requires :logs, type: Array[String], documentation: { param_type: 'body' }
        end

        post do
          present params
        end
      end

      add_swagger_documentation format: :json
    end
  end

  subject do
    get '/swagger_doc'
    JSON.parse(last_response.body)
  end

  let(:parameters) { subject['paths']['/issue_542']['post']['parameters'] }

  specify do
    expect(parameters).to eql(
      [
        {
          'in' => 'body',
          'name' => 'logs',
          'required' => true,
          'schema' => {
            'type' => 'array',
            'items' => {
              'type' => 'string'
            }
          }
        }
      ]
    )
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grape-swagger-0.26.1 spec/issues/542_array_of_type_in_post_body_spec.rb
grape-swagger-0.26.0 spec/issues/542_array_of_type_in_post_body_spec.rb
grape-swagger-0.25.3 spec/issues/542_array_of_type_in_post_body_spec.rb