Sha256: aa7a5d87b88ca98d0ffa31fe84e9874f6c0b88dc49158a0f4f9af8c71c327e80
Contents?: true
Size: 849 Bytes
Versions: 5
Compression:
Stored size: 849 Bytes
Contents
require 'spec_helper' describe 'API with minimally documented models' do def app entity_klass = Class.new do def self.exposures {} end def self.documentation { bar: { type: String }, foo: {} } end def self.entity_name 'Foo' end end Class.new(Grape::API) do format :json get :foo do end add_swagger_documentation \ format: :json, models: [Class.new(entity_klass)] end end subject do get '/swagger_doc/foo' JSON.parse(last_response.body)['models'] end it 'returns model' do expect(subject).to eq( 'Foo' => { 'id' => 'Foo', 'properties' => { 'bar' => { 'type' => 'string' }, 'foo' => { '$ref' => nil } } } ) end end
Version data entries
5 entries across 5 versions & 1 rubygems