grape-swagger 0.34.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +86 -0
- data/.travis.yml +19 -12
- data/CHANGELOG.md +47 -4
- data/Gemfile +9 -3
- data/README.md +125 -12
- data/UPGRADING.md +34 -0
- data/grape-swagger.gemspec +1 -2
- data/lib/grape-swagger.rb +2 -2
- data/lib/grape-swagger/doc_methods.rb +65 -62
- data/lib/grape-swagger/doc_methods/build_model_definition.rb +53 -2
- data/lib/grape-swagger/doc_methods/data_type.rb +6 -6
- data/lib/grape-swagger/doc_methods/format_data.rb +2 -2
- data/lib/grape-swagger/doc_methods/operation_id.rb +2 -2
- data/lib/grape-swagger/doc_methods/parse_params.rb +19 -4
- data/lib/grape-swagger/endpoint.rb +37 -26
- data/lib/grape-swagger/endpoint/params_parser.rb +12 -5
- data/lib/grape-swagger/rake/oapi_tasks.rb +12 -2
- data/lib/grape-swagger/version.rb +1 -1
- data/spec/issues/427_entity_as_string_spec.rb +1 -1
- data/spec/issues/430_entity_definitions_spec.rb +7 -5
- data/spec/issues/784_extensions_on_params_spec.rb +38 -0
- data/spec/lib/data_type_spec.rb +14 -2
- data/spec/lib/endpoint/params_parser_spec.rb +2 -1
- data/spec/lib/endpoint_spec.rb +1 -1
- data/spec/lib/move_params_spec.rb +2 -2
- data/spec/lib/oapi_tasks_spec.rb +15 -5
- data/spec/support/empty_model_parser.rb +1 -2
- data/spec/support/mock_parser.rb +1 -2
- data/spec/support/model_parsers/entity_parser.rb +9 -9
- data/spec/support/model_parsers/mock_parser.rb +8 -8
- data/spec/support/model_parsers/representable_parser.rb +9 -9
- data/spec/swagger_v2/api_swagger_v2_hide_param_spec.rb +14 -3
- data/spec/swagger_v2/api_swagger_v2_param_type_body_spec.rb +2 -2
- data/spec/swagger_v2/api_swagger_v2_response_with_models_spec.rb +53 -0
- data/spec/swagger_v2/boolean_params_spec.rb +1 -1
- data/spec/swagger_v2/inheritance_and_discriminator_spec.rb +56 -0
- data/spec/swagger_v2/reference_entity_spec.rb +74 -29
- data/spec/swagger_v2/security_requirement_spec.rb +2 -2
- metadata +17 -31
@@ -3,15 +3,16 @@
|
|
3
3
|
module GrapeSwagger
|
4
4
|
module Endpoint
|
5
5
|
class ParamsParser
|
6
|
-
attr_reader :params, :settings
|
6
|
+
attr_reader :params, :settings, :endpoint
|
7
7
|
|
8
|
-
def self.parse_request_params(params, settings)
|
9
|
-
new(params, settings).parse_request_params
|
8
|
+
def self.parse_request_params(params, settings, endpoint)
|
9
|
+
new(params, settings, endpoint).parse_request_params
|
10
10
|
end
|
11
11
|
|
12
|
-
def initialize(params, settings)
|
12
|
+
def initialize(params, settings, endpoint)
|
13
13
|
@params = params
|
14
14
|
@settings = settings
|
15
|
+
@endpoint = endpoint
|
15
16
|
end
|
16
17
|
|
17
18
|
def parse_request_params
|
@@ -55,7 +56,13 @@ module GrapeSwagger
|
|
55
56
|
return true unless param_options.key?(:documentation) && !param_options[:required]
|
56
57
|
|
57
58
|
param_hidden = param_options[:documentation].fetch(:hidden, false)
|
58
|
-
|
59
|
+
if param_hidden.is_a?(Proc)
|
60
|
+
param_hidden = if settings[:token_owner]
|
61
|
+
param_hidden.call(endpoint.send(settings[:token_owner].to_sym))
|
62
|
+
else
|
63
|
+
param_hidden.call
|
64
|
+
end
|
65
|
+
end
|
59
66
|
!param_hidden
|
60
67
|
end
|
61
68
|
|
@@ -10,17 +10,25 @@ module GrapeSwagger
|
|
10
10
|
include Rack::Test::Methods
|
11
11
|
|
12
12
|
attr_reader :oapi
|
13
|
-
attr_reader :api_class
|
14
13
|
|
15
14
|
def initialize(api_class)
|
16
15
|
super()
|
17
16
|
|
18
|
-
|
17
|
+
if api_class.is_a? String
|
18
|
+
@api_class_name = api_class
|
19
|
+
else
|
20
|
+
@api_class = api_class
|
21
|
+
end
|
22
|
+
|
19
23
|
define_tasks
|
20
24
|
end
|
21
25
|
|
22
26
|
private
|
23
27
|
|
28
|
+
def api_class
|
29
|
+
@api_class ||= @api_class_name.constantize
|
30
|
+
end
|
31
|
+
|
24
32
|
def define_tasks
|
25
33
|
namespace :oapi do
|
26
34
|
fetch
|
@@ -66,6 +74,7 @@ module GrapeSwagger
|
|
66
74
|
|
67
75
|
# helper methods
|
68
76
|
#
|
77
|
+
# rubocop:disable Style/StringConcatenation
|
69
78
|
def make_request
|
70
79
|
get url_for
|
71
80
|
|
@@ -75,6 +84,7 @@ module GrapeSwagger
|
|
75
84
|
)
|
76
85
|
) + "\n"
|
77
86
|
end
|
87
|
+
# rubocop:enable Style/StringConcatenation
|
78
88
|
|
79
89
|
def url_for
|
80
90
|
oapi_route = api_class.routes[-2]
|
@@ -35,5 +35,5 @@ describe '#427 nested entity given as string' do
|
|
35
35
|
JSON.parse(last_response.body)['definitions']
|
36
36
|
end
|
37
37
|
|
38
|
-
specify { expect(subject.keys).to include 'RoleEntity', '
|
38
|
+
specify { expect(subject.keys).to include 'RoleEntity', 'Permission_WithoutRole' }
|
39
39
|
end
|
@@ -55,6 +55,8 @@ describe 'definition names' do
|
|
55
55
|
class Class7
|
56
56
|
class SeventhEntity < Class6::SixthEntity
|
57
57
|
expose :seventh_thing
|
58
|
+
|
59
|
+
private_class_method :entity_name
|
58
60
|
end
|
59
61
|
end
|
60
62
|
end
|
@@ -82,11 +84,11 @@ describe 'definition names' do
|
|
82
84
|
JSON.parse(last_response.body)['definitions']
|
83
85
|
end
|
84
86
|
|
85
|
-
specify { expect(subject).to include '
|
86
|
-
specify { expect(subject).to include '
|
87
|
+
specify { expect(subject).to include 'TestDefinition_DummyEntities_WithVeryLongName_AnotherGroupingModule_Class1' }
|
88
|
+
specify { expect(subject).to include 'TestDefinition_DummyEntities_WithVeryLongName_AnotherGroupingModule_Class2' }
|
87
89
|
specify { expect(subject).to include 'FooKlass' }
|
88
|
-
specify { expect(subject).to include '
|
89
|
-
specify { expect(subject).to include '
|
90
|
+
specify { expect(subject).to include 'TestDefinition_DummyEntities_WithVeryLongName_AnotherGroupingModule_Class4_FourthEntity' }
|
91
|
+
specify { expect(subject).to include 'TestDefinition_DummyEntities_WithVeryLongName_AnotherGroupingModule_Class5_FithEntity' }
|
90
92
|
specify { expect(subject).to include 'BarKlass' }
|
91
|
-
specify { expect(subject).to include '
|
93
|
+
specify { expect(subject).to include 'TestDefinition_DummyEntities_WithVeryLongName_AnotherGroupingModule_Class7_SeventhEntity' }
|
92
94
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe '#532 allow custom format' do
|
6
|
+
let(:app) do
|
7
|
+
Class.new(Grape::API) do
|
8
|
+
namespace :issue_784 do
|
9
|
+
params do
|
10
|
+
requires :logs, type: String, documentation: { format: 'log', x: { name: 'Log' } }
|
11
|
+
optional :phone_number, type: Integer, documentation: { format: 'phone_number', x: { name: 'PhoneNumber' } }
|
12
|
+
end
|
13
|
+
|
14
|
+
post do
|
15
|
+
present params
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
add_swagger_documentation format: :json
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
subject do
|
24
|
+
get '/swagger_doc'
|
25
|
+
JSON.parse(last_response.body)
|
26
|
+
end
|
27
|
+
|
28
|
+
let(:parameters) { subject['paths']['/issue_784']['post']['parameters'] }
|
29
|
+
|
30
|
+
specify do
|
31
|
+
expect(parameters).to eql(
|
32
|
+
[
|
33
|
+
{ 'in' => 'formData', 'name' => 'logs', 'type' => 'string', 'format' => 'log', 'required' => true, 'x-name' => 'Log' },
|
34
|
+
{ 'in' => 'formData', 'name' => 'phone_number', 'type' => 'integer', 'format' => 'phone_number', 'required' => false, 'x-name' => 'PhoneNumber' }
|
35
|
+
]
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
data/spec/lib/data_type_spec.rb
CHANGED
@@ -49,14 +49,26 @@ describe GrapeSwagger::DocMethods::DataType do
|
|
49
49
|
it { is_expected.to eq 'MyInteger' }
|
50
50
|
end
|
51
51
|
|
52
|
+
describe 'Types in array with inherited entity_name' do
|
53
|
+
before do
|
54
|
+
stub_const 'EntityBase', Class.new
|
55
|
+
allow(EntityBase).to receive(:entity_name).and_return 'MyInteger'
|
56
|
+
stub_const 'MyEntity', Class.new(EntityBase)
|
57
|
+
end
|
58
|
+
|
59
|
+
let(:value) { { type: '[MyEntity]' } }
|
60
|
+
|
61
|
+
it { is_expected.to eq 'MyInteger' }
|
62
|
+
end
|
63
|
+
|
52
64
|
describe 'Rack::Multipart::UploadedFile' do
|
53
65
|
let(:value) { { type: Rack::Multipart::UploadedFile } }
|
54
66
|
|
55
67
|
it { is_expected.to eq 'file' }
|
56
68
|
end
|
57
69
|
|
58
|
-
describe '
|
59
|
-
let(:value) { { type:
|
70
|
+
describe 'Grape::API::Boolean' do
|
71
|
+
let(:value) { { type: Grape::API::Boolean } }
|
60
72
|
|
61
73
|
it { is_expected.to eq 'boolean' }
|
62
74
|
end
|
@@ -5,8 +5,9 @@ require 'spec_helper'
|
|
5
5
|
describe GrapeSwagger::Endpoint::ParamsParser do
|
6
6
|
let(:settings) { {} }
|
7
7
|
let(:params) { [] }
|
8
|
+
let(:endpoint) { nil }
|
8
9
|
|
9
|
-
let(:parser) { described_class.new(params, settings) }
|
10
|
+
let(:parser) { described_class.new(params, settings, endpoint) }
|
10
11
|
|
11
12
|
describe '#parse_request_params' do
|
12
13
|
subject(:parse_request_params) { parser.parse_request_params }
|
data/spec/lib/endpoint_spec.rb
CHANGED
@@ -49,7 +49,7 @@ describe Grape::Endpoint do
|
|
49
49
|
describe 'parse_request_params' do
|
50
50
|
let(:subject) { GrapeSwagger::Endpoint::ParamsParser }
|
51
51
|
before do
|
52
|
-
subject.send(:parse_request_params, params, {})
|
52
|
+
subject.send(:parse_request_params, params, {}, nil)
|
53
53
|
end
|
54
54
|
|
55
55
|
context 'when params do not contain an array' do
|
@@ -97,7 +97,7 @@ describe GrapeSwagger::DocMethods::MoveParams do
|
|
97
97
|
let(:route_options) { { requirements: {} } }
|
98
98
|
describe 'POST' do
|
99
99
|
let(:params) { paths[path][:post][:parameters] }
|
100
|
-
let(:route) { Grape::Router::Route.new('POST', path.dup, route_options) }
|
100
|
+
let(:route) { Grape::Router::Route.new('POST', path.dup, **route_options) }
|
101
101
|
|
102
102
|
specify do
|
103
103
|
subject.to_definition(path, params, route, definitions)
|
@@ -113,7 +113,7 @@ describe GrapeSwagger::DocMethods::MoveParams do
|
|
113
113
|
|
114
114
|
describe 'POST' do
|
115
115
|
let(:params) { paths['/in_body/{key}'][:put][:parameters] }
|
116
|
-
let(:route) { Grape::Router::Route.new('PUT', path.dup, route_options) }
|
116
|
+
let(:route) { Grape::Router::Route.new('PUT', path.dup, **route_options) }
|
117
117
|
|
118
118
|
specify do
|
119
119
|
subject.to_definition(path, params, route, definitions)
|
data/spec/lib/oapi_tasks_spec.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe GrapeSwagger::Rake::OapiTasks do
|
6
|
-
|
7
|
-
|
6
|
+
module Api
|
7
|
+
class Item < Grape::API
|
8
8
|
version 'v1', using: :path
|
9
9
|
|
10
10
|
namespace :item do
|
@@ -16,14 +16,24 @@ RSpec.describe GrapeSwagger::Rake::OapiTasks do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
class Base < Grape::API
|
20
20
|
prefix :api
|
21
|
-
mount
|
21
|
+
mount Api::Item
|
22
22
|
add_swagger_documentation add_version: true
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
subject { described_class.new(
|
26
|
+
subject { described_class.new(Api::Base) }
|
27
|
+
|
28
|
+
describe '.new' do
|
29
|
+
it 'accepts class name as a constant' do
|
30
|
+
expect(described_class.new(::Api::Base).send(:api_class)).to eq(Api::Base)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'accepts class name as a string' do
|
34
|
+
expect(described_class.new('::Api::Base').send(:api_class)).to eq(Api::Base)
|
35
|
+
end
|
36
|
+
end
|
27
37
|
|
28
38
|
describe '#make_request' do
|
29
39
|
describe 'complete documentation' do
|
data/spec/support/mock_parser.rb
CHANGED
@@ -116,7 +116,7 @@ RSpec.shared_context 'entity swagger example' do
|
|
116
116
|
expose :prop_time, documentation: { type: Time, desc: 'prop_time description' }
|
117
117
|
expose :prop_password, documentation: { type: 'password', desc: 'prop_password description' }
|
118
118
|
expose :prop_email, documentation: { type: 'email', desc: 'prop_email description' }
|
119
|
-
expose :prop_boolean, documentation: { type:
|
119
|
+
expose :prop_boolean, documentation: { type: Grape::API::Boolean, desc: 'prop_boolean description' }
|
120
120
|
expose :prop_file, documentation: { type: File, desc: 'prop_file description' }
|
121
121
|
expose :prop_json, documentation: { type: JSON, desc: 'prop_json description' }
|
122
122
|
end
|
@@ -145,23 +145,23 @@ RSpec.shared_context 'entity swagger example' do
|
|
145
145
|
|
146
146
|
let(:swagger_nested_type) do
|
147
147
|
{
|
148
|
-
'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'type' => 'integer', 'format' => 'int32', 'description' => 'status code' }, 'message' => { 'type' => 'string', 'description' => 'error message' } }, 'description' => '
|
148
|
+
'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'type' => 'integer', 'format' => 'int32', 'description' => 'status code' }, 'message' => { 'type' => 'string', 'description' => 'error message' } }, 'description' => 'ApiError model' },
|
149
149
|
'ResponseItem' => { 'type' => 'object', 'properties' => { 'id' => { 'type' => 'integer', 'format' => 'int32' }, 'name' => { 'type' => 'string' } } },
|
150
|
-
'UseItemResponseAsType' => { 'type' => 'object', 'properties' => { 'description' => { 'type' => 'string' }, 'responses' => { '$ref' => '#/definitions/ResponseItem' } }, 'description' => '
|
150
|
+
'UseItemResponseAsType' => { 'type' => 'object', 'properties' => { 'description' => { 'type' => 'string' }, 'responses' => { '$ref' => '#/definitions/ResponseItem' } }, 'description' => 'UseItemResponseAsType model' }
|
151
151
|
}
|
152
152
|
end
|
153
153
|
|
154
154
|
let(:swagger_entity_as_response_object) do
|
155
155
|
{
|
156
|
-
'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'type' => 'integer', 'format' => 'int32', 'description' => 'status code' }, 'message' => { 'type' => 'string', 'description' => 'error message' } }, 'description' => '
|
156
|
+
'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'type' => 'integer', 'format' => 'int32', 'description' => 'status code' }, 'message' => { 'type' => 'string', 'description' => 'error message' } }, 'description' => 'ApiError model' },
|
157
157
|
'ResponseItem' => { 'type' => 'object', 'properties' => { 'id' => { 'type' => 'integer', 'format' => 'int32' }, 'name' => { 'type' => 'string' } } },
|
158
|
-
'UseResponse' => { 'type' => 'object', 'properties' => { 'description' => { 'type' => 'string' }, '$responses' => { 'type' => 'array', 'items' => { '$ref' => '#/definitions/ResponseItem' } } }, 'description' => '
|
158
|
+
'UseResponse' => { 'type' => 'object', 'properties' => { 'description' => { 'type' => 'string' }, '$responses' => { 'type' => 'array', 'items' => { '$ref' => '#/definitions/ResponseItem' } } }, 'description' => 'UseResponse model' }
|
159
159
|
}
|
160
160
|
end
|
161
161
|
|
162
162
|
let(:swagger_params_as_response_object) do
|
163
163
|
{
|
164
|
-
'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'description' => 'status code', 'type' => 'integer', 'format' => 'int32' }, 'message' => { 'description' => 'error message', 'type' => 'string' } }, 'description' => '
|
164
|
+
'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'description' => 'status code', 'type' => 'integer', 'format' => 'int32' }, 'message' => { 'description' => 'error message', 'type' => 'string' } }, 'description' => 'ApiError model' }
|
165
165
|
}
|
166
166
|
end
|
167
167
|
|
@@ -300,7 +300,7 @@ RSpec.shared_context 'entity swagger example' do
|
|
300
300
|
'type' => 'object',
|
301
301
|
'required' => ['elements'],
|
302
302
|
'properties' => { 'elements' => { 'type' => 'array', 'items' => { '$ref' => '#/definitions/QueryInputElement' }, 'description' => 'Set of configuration' } },
|
303
|
-
'description' => '
|
303
|
+
'description' => 'QueryInput model'
|
304
304
|
},
|
305
305
|
'QueryInputElement' => {
|
306
306
|
'type' => 'object',
|
@@ -310,7 +310,7 @@ RSpec.shared_context 'entity swagger example' do
|
|
310
310
|
'ApiError' => {
|
311
311
|
'type' => 'object',
|
312
312
|
'properties' => { 'code' => { 'type' => 'integer', 'format' => 'int32', 'description' => 'status code' }, 'message' => { 'type' => 'string', 'description' => 'error message' } },
|
313
|
-
'description' => '
|
313
|
+
'description' => 'ApiError model'
|
314
314
|
},
|
315
315
|
'Something' => {
|
316
316
|
'type' => 'object',
|
@@ -320,7 +320,7 @@ RSpec.shared_context 'entity swagger example' do
|
|
320
320
|
'links' => { 'type' => 'array', 'items' => { 'type' => 'link' } },
|
321
321
|
'others' => { 'type' => 'text' }
|
322
322
|
},
|
323
|
-
'description' => '
|
323
|
+
'description' => 'Something model'
|
324
324
|
}
|
325
325
|
}
|
326
326
|
}
|
@@ -112,7 +112,7 @@ RSpec.shared_context 'mock swagger example' do
|
|
112
112
|
'description' => "it's a mock"
|
113
113
|
}
|
114
114
|
},
|
115
|
-
'description' => '
|
115
|
+
'description' => 'ApiError model'
|
116
116
|
},
|
117
117
|
'UseItemResponseAsType' => {
|
118
118
|
'type' => 'object',
|
@@ -122,7 +122,7 @@ RSpec.shared_context 'mock swagger example' do
|
|
122
122
|
'description' => "it's a mock"
|
123
123
|
}
|
124
124
|
},
|
125
|
-
'description' => '
|
125
|
+
'description' => 'UseItemResponseAsType model'
|
126
126
|
}
|
127
127
|
}
|
128
128
|
end
|
@@ -137,7 +137,7 @@ RSpec.shared_context 'mock swagger example' do
|
|
137
137
|
'description' => "it's a mock"
|
138
138
|
}
|
139
139
|
},
|
140
|
-
'description' => '
|
140
|
+
'description' => 'UseResponse model'
|
141
141
|
},
|
142
142
|
'ApiError' => {
|
143
143
|
'type' => 'object',
|
@@ -147,7 +147,7 @@ RSpec.shared_context 'mock swagger example' do
|
|
147
147
|
'description' => "it's a mock"
|
148
148
|
}
|
149
149
|
},
|
150
|
-
'description' => '
|
150
|
+
'description' => 'ApiError model'
|
151
151
|
}
|
152
152
|
}
|
153
153
|
end
|
@@ -162,7 +162,7 @@ RSpec.shared_context 'mock swagger example' do
|
|
162
162
|
'description' => "it's a mock"
|
163
163
|
}
|
164
164
|
},
|
165
|
-
'description' => '
|
165
|
+
'description' => 'ApiError model'
|
166
166
|
}
|
167
167
|
}
|
168
168
|
end
|
@@ -296,7 +296,7 @@ RSpec.shared_context 'mock swagger example' do
|
|
296
296
|
'description' => "it's a mock"
|
297
297
|
}
|
298
298
|
},
|
299
|
-
'description' => '
|
299
|
+
'description' => 'QueryInput model'
|
300
300
|
},
|
301
301
|
'ApiError' => {
|
302
302
|
'type' => 'object',
|
@@ -306,7 +306,7 @@ RSpec.shared_context 'mock swagger example' do
|
|
306
306
|
'description' => "it's a mock"
|
307
307
|
}
|
308
308
|
},
|
309
|
-
'description' => '
|
309
|
+
'description' => 'ApiError model'
|
310
310
|
},
|
311
311
|
'Something' => {
|
312
312
|
'type' => 'object',
|
@@ -316,7 +316,7 @@ RSpec.shared_context 'mock swagger example' do
|
|
316
316
|
'description' => "it's a mock"
|
317
317
|
}
|
318
318
|
},
|
319
|
-
'description' => '
|
319
|
+
'description' => 'Something model'
|
320
320
|
}
|
321
321
|
}
|
322
322
|
}
|
@@ -186,7 +186,7 @@ RSpec.shared_context 'representable swagger example' do
|
|
186
186
|
property :prop_time, documentation: { type: Time, desc: 'prop_time description' }
|
187
187
|
property :prop_password, documentation: { type: 'password', desc: 'prop_password description' }
|
188
188
|
property :prop_email, documentation: { type: 'email', desc: 'prop_email description' }
|
189
|
-
property :prop_boolean, documentation: { type:
|
189
|
+
property :prop_boolean, documentation: { type: Grape::API::Boolean, desc: 'prop_boolean description' }
|
190
190
|
property :prop_file, documentation: { type: File, desc: 'prop_file description' }
|
191
191
|
property :prop_json, documentation: { type: JSON, desc: 'prop_json description' }
|
192
192
|
end
|
@@ -218,22 +218,22 @@ RSpec.shared_context 'representable swagger example' do
|
|
218
218
|
|
219
219
|
let(:swagger_nested_type) do
|
220
220
|
{
|
221
|
-
'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'description' => 'status code', 'type' => 'integer', 'format' => 'int32' }, 'message' => { 'description' => 'error message', 'type' => 'string' } }, 'description' => '
|
222
|
-
'UseItemResponseAsType' => { 'type' => 'object', 'properties' => { 'description' => { 'description' => '', 'type' => 'string' }, 'responses' => { 'description' => '', 'type' => 'ResponseItem' } }, 'description' => '
|
221
|
+
'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'description' => 'status code', 'type' => 'integer', 'format' => 'int32' }, 'message' => { 'description' => 'error message', 'type' => 'string' } }, 'description' => 'ApiError model' },
|
222
|
+
'UseItemResponseAsType' => { 'type' => 'object', 'properties' => { 'description' => { 'description' => '', 'type' => 'string' }, 'responses' => { 'description' => '', 'type' => 'ResponseItem' } }, 'description' => 'UseItemResponseAsType model' }
|
223
223
|
}
|
224
224
|
end
|
225
225
|
|
226
226
|
let(:swagger_entity_as_response_object) do
|
227
227
|
{
|
228
|
-
'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'description' => 'status code', 'type' => 'integer', 'format' => 'int32' }, 'message' => { 'description' => 'error message', 'type' => 'string' } }, 'description' => '
|
228
|
+
'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'description' => 'status code', 'type' => 'integer', 'format' => 'int32' }, 'message' => { 'description' => 'error message', 'type' => 'string' } }, 'description' => 'ApiError model' },
|
229
229
|
'ResponseItem' => { 'type' => 'object', 'properties' => { 'id' => { 'description' => '', 'type' => 'integer', 'format' => 'int32' }, 'name' => { 'description' => '', 'type' => 'string' } } },
|
230
|
-
'UseResponse' => { 'type' => 'object', 'properties' => { 'description' => { 'description' => '', 'type' => 'string' }, '$responses' => { 'type' => 'array', 'items' => { '$ref' => '#/definitions/ResponseItem' }, 'description' => '' } }, 'description' => '
|
230
|
+
'UseResponse' => { 'type' => 'object', 'properties' => { 'description' => { 'description' => '', 'type' => 'string' }, '$responses' => { 'type' => 'array', 'items' => { '$ref' => '#/definitions/ResponseItem' }, 'description' => '' } }, 'description' => 'UseResponse model' }
|
231
231
|
}
|
232
232
|
end
|
233
233
|
|
234
234
|
let(:swagger_params_as_response_object) do
|
235
235
|
{
|
236
|
-
'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'description' => 'status code', 'type' => 'integer', 'format' => 'int32' }, 'message' => { 'description' => 'error message', 'type' => 'string' } }, 'description' => '
|
236
|
+
'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'description' => 'status code', 'type' => 'integer', 'format' => 'int32' }, 'message' => { 'description' => 'error message', 'type' => 'string' } }, 'description' => 'ApiError model' }
|
237
237
|
}
|
238
238
|
end
|
239
239
|
|
@@ -372,7 +372,7 @@ RSpec.shared_context 'representable swagger example' do
|
|
372
372
|
'type' => 'object',
|
373
373
|
'required' => ['elements'],
|
374
374
|
'properties' => { 'elements' => { 'type' => 'array', 'items' => { '$ref' => '#/definitions/QueryInputElement' }, 'description' => 'Set of configuration' } },
|
375
|
-
'description' => '
|
375
|
+
'description' => 'QueryInput model'
|
376
376
|
},
|
377
377
|
'QueryInputElement' => {
|
378
378
|
'type' => 'object',
|
@@ -382,7 +382,7 @@ RSpec.shared_context 'representable swagger example' do
|
|
382
382
|
'ApiError' => {
|
383
383
|
'type' => 'object',
|
384
384
|
'properties' => { 'code' => { 'type' => 'integer', 'format' => 'int32', 'description' => 'status code' }, 'message' => { 'type' => 'string', 'description' => 'error message' } },
|
385
|
-
'description' => '
|
385
|
+
'description' => 'ApiError model'
|
386
386
|
},
|
387
387
|
'Something' => {
|
388
388
|
'type' => 'object',
|
@@ -392,7 +392,7 @@ RSpec.shared_context 'representable swagger example' do
|
|
392
392
|
'links' => { 'type' => 'array', 'items' => { 'description' => '', 'type' => 'link' } },
|
393
393
|
'others' => { 'description' => '', 'type' => 'text' }
|
394
394
|
},
|
395
|
-
'description' => '
|
395
|
+
'description' => 'Something model'
|
396
396
|
}
|
397
397
|
}
|
398
398
|
}
|