Sha256: dee0b4ddec9446c1717284c77ce9dce0c2fe8c091c9443bada74176888373f82
Contents?: true
Size: 1.02 KB
Versions: 11
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe '#532 allow custom format' do let(:app) do Class.new(Grape::API) do namespace :issue_784 do params do requires :logs, type: String, documentation: { format: 'log', x: { name: 'Log' } } optional :phone_number, type: Integer, documentation: { format: 'phone_number', x: { name: 'PhoneNumber' } } 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_784']['post']['parameters'] } specify do expect(parameters).to eql( [ { 'in' => 'formData', 'name' => 'logs', 'type' => 'string', 'format' => 'log', 'required' => true, 'x-name' => 'Log' }, { 'in' => 'formData', 'name' => 'phone_number', 'type' => 'integer', 'format' => 'phone_number', 'required' => false, 'x-name' => 'PhoneNumber' } ] ) end end
Version data entries
11 entries across 11 versions & 1 rubygems