grape-swagger 0.20.2 → 0.20.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -3
- data/.rubocop_todo.yml +43 -33
- data/.travis.yml +22 -13
- data/CHANGELOG.md +29 -53
- data/Gemfile +1 -1
- data/README.md +24 -24
- data/example/api/endpoints.rb +28 -29
- data/example/api/entities.rb +1 -1
- data/example/config.ru +5 -7
- data/grape-swagger.gemspec +1 -1
- data/lib/grape-swagger.rb +9 -6
- data/lib/grape-swagger/doc_methods.rb +1 -1
- data/lib/grape-swagger/doc_methods/extensions.rb +3 -3
- data/lib/grape-swagger/doc_methods/headers.rb +1 -1
- data/lib/grape-swagger/doc_methods/move_params.rb +25 -16
- data/lib/grape-swagger/doc_methods/operation_id.rb +2 -2
- data/lib/grape-swagger/doc_methods/parse_params.rb +12 -5
- data/lib/grape-swagger/doc_methods/path_string.rb +1 -1
- data/lib/grape-swagger/doc_methods/status_codes.rb +3 -1
- data/lib/grape-swagger/doc_methods/tag_name_description.rb +1 -1
- data/lib/grape-swagger/endpoint.rb +33 -46
- data/lib/grape-swagger/grape/route.rb +16 -0
- data/lib/grape-swagger/version.rb +1 -1
- data/spec/issues/403_versions_spec.rb +158 -0
- data/spec/lib/data_type_spec.rb +9 -10
- data/spec/lib/endpoint_spec.rb +1 -2
- data/spec/lib/extensions_spec.rb +44 -40
- data/spec/lib/move_params_spec.rb +113 -93
- data/spec/lib/operation_id_spec.rb +42 -12
- data/spec/lib/optional_object_spec.rb +3 -4
- data/spec/lib/path_string_spec.rb +2 -2
- data/spec/lib/produces_consumes_spec.rb +64 -53
- data/spec/markdown/redcarpet_adapter_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/api_swagger_v2_result.rb +122 -128
- data/spec/support/namespace_tags.rb +17 -19
- data/spec/support/the_api_entities.rb +1 -3
- data/spec/support/the_paths_definitions.rb +95 -85
- data/spec/swagger_v2/api_swagger_v2_definitions-models_spec.rb +1 -1
- data/spec/swagger_v2/api_swagger_v2_detail_spec.rb +19 -19
- data/spec/swagger_v2/api_swagger_v2_extensions_spec.rb +21 -21
- data/spec/swagger_v2/api_swagger_v2_format-content_type_spec.rb +34 -32
- data/spec/swagger_v2/api_swagger_v2_global_configuration_spec.rb +5 -7
- data/spec/swagger_v2/api_swagger_v2_headers_spec.rb +19 -18
- data/spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb +9 -10
- data/spec/swagger_v2/api_swagger_v2_mounted_spec.rb +21 -24
- data/spec/swagger_v2/api_swagger_v2_param_type_body_nested_spec.rb +90 -92
- data/spec/swagger_v2/api_swagger_v2_param_type_body_spec.rb +54 -54
- data/spec/swagger_v2/api_swagger_v2_param_type_spec.rb +65 -57
- data/spec/swagger_v2/api_swagger_v2_request_params_fix_spec.rb +17 -14
- data/spec/swagger_v2/api_swagger_v2_response_spec.rb +79 -123
- data/spec/swagger_v2/api_swagger_v2_spec.rb +33 -34
- data/spec/swagger_v2/api_swagger_v2_type-format_spec.rb +32 -36
- data/spec/swagger_v2/boolean_params_spec.rb +1 -1
- data/spec/swagger_v2/default_api_spec.rb +26 -29
- data/spec/swagger_v2/description_not_initialized.rb +3 -3
- data/spec/swagger_v2/float_api_spec.rb +1 -1
- data/spec/swagger_v2/form_params_spec.rb +4 -4
- data/spec/swagger_v2/hide_api_spec.rb +48 -51
- data/spec/swagger_v2/host.rb +1 -1
- data/spec/swagger_v2/mounted_target_class_spec.rb +31 -33
- data/spec/swagger_v2/namespace_tags_prefix_spec.rb +23 -21
- data/spec/swagger_v2/namespace_tags_spec.rb +23 -20
- data/spec/swagger_v2/param_type_spec.rb +5 -6
- data/spec/swagger_v2/param_values_spec.rb +31 -37
- data/spec/swagger_v2/params_array_spec.rb +17 -15
- data/spec/swagger_v2/params_hash_spec.rb +17 -15
- data/spec/swagger_v2/params_nested_spec.rb +12 -10
- data/spec/swagger_v2/reference_entity.rb +9 -9
- data/spec/swagger_v2/response_model_spec.rb +58 -62
- data/spec/swagger_v2/simple_mounted_api_spec.rb +179 -147
- metadata +5 -10
- data/spec/params_entity_spec.rb +0 -49
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `header`' do
|
4
|
-
include_context
|
4
|
+
include_context 'the api entities'
|
5
5
|
|
6
6
|
before :all do
|
7
7
|
module TheApi
|
@@ -15,7 +15,7 @@ describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `h
|
|
15
15
|
end
|
16
16
|
|
17
17
|
post '/in_body' do
|
18
|
-
{
|
18
|
+
{ 'declared_params' => declared(params) }
|
19
19
|
end
|
20
20
|
|
21
21
|
desc 'put in body /wo entity'
|
@@ -27,30 +27,30 @@ describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `h
|
|
27
27
|
end
|
28
28
|
|
29
29
|
put '/in_body/:key' do
|
30
|
-
{
|
30
|
+
{ 'declared_params' => declared(params) }
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
namespace :with_entities do
|
35
35
|
desc 'post in body with entity',
|
36
|
-
|
36
|
+
success: TheApi::Entities::ResponseItem
|
37
37
|
params do
|
38
38
|
requires :name, type: String, documentation: { desc: 'name', param_type: 'body' }
|
39
39
|
end
|
40
40
|
|
41
41
|
post '/in_body' do
|
42
|
-
{
|
42
|
+
{ 'declared_params' => declared(params) }
|
43
43
|
end
|
44
44
|
|
45
45
|
desc 'put in body with entity',
|
46
|
-
|
46
|
+
success: TheApi::Entities::ResponseItem
|
47
47
|
params do
|
48
48
|
requires :id, type: Integer
|
49
49
|
optional :name, type: String, documentation: { desc: 'name', param_type: 'body' }
|
50
50
|
end
|
51
51
|
|
52
52
|
put '/in_body/:id' do
|
53
|
-
{
|
53
|
+
{ 'declared_params' => declared(params) }
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -70,42 +70,42 @@ describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `h
|
|
70
70
|
end
|
71
71
|
|
72
72
|
specify do
|
73
|
-
expect(subject['paths']['/wo_entities/in_body']['post']['parameters']).to eql(
|
74
|
-
|
75
|
-
|
73
|
+
expect(subject['paths']['/wo_entities/in_body']['post']['parameters']).to eql(
|
74
|
+
[
|
75
|
+
{ 'name' => 'postWoEntitiesInBody', 'in' => 'body', 'required' => true, 'schema' => { '$ref' => '#/definitions/postWoEntitiesInBody' } }
|
76
|
+
])
|
76
77
|
end
|
77
78
|
|
78
79
|
specify do
|
79
|
-
expect(subject['definitions']['
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
80
|
+
expect(subject['definitions']['postWoEntitiesInBody']).to eql(
|
81
|
+
'description' => 'post in body /wo entity',
|
82
|
+
'type' => 'object',
|
83
|
+
'properties' => {
|
84
|
+
'in_body_1' => { 'type' => 'integer', 'format' => 'int32', 'description' => 'in_body_1' },
|
85
|
+
'in_body_2' => { 'type' => 'string', 'description' => 'in_body_2' },
|
86
|
+
'in_body_3' => { 'type' => 'string', 'description' => 'in_body_3' }
|
86
87
|
},
|
87
|
-
|
88
|
-
})
|
88
|
+
'required' => ['in_body_1'])
|
89
89
|
end
|
90
90
|
|
91
91
|
specify do
|
92
|
-
expect(subject['paths']['/wo_entities/in_body/{key}']['put']['parameters']).to eql(
|
93
|
-
|
94
|
-
|
95
|
-
|
92
|
+
expect(subject['paths']['/wo_entities/in_body/{key}']['put']['parameters']).to eql(
|
93
|
+
[
|
94
|
+
{ 'in' => 'path', 'name' => 'key', 'type' => 'integer', 'format' => 'int32', 'required' => true },
|
95
|
+
{ 'name' => 'putWoEntitiesInBodyKey', 'in' => 'body', 'required' => true, 'schema' => { '$ref' => '#/definitions/putWoEntitiesInBodyKey' } }
|
96
|
+
])
|
96
97
|
end
|
97
98
|
|
98
99
|
specify do
|
99
|
-
expect(subject['definitions']['
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
}
|
108
|
-
})
|
100
|
+
expect(subject['definitions']['putWoEntitiesInBodyKey']).to eql(
|
101
|
+
'description' => 'put in body /wo entity',
|
102
|
+
'type' => 'object',
|
103
|
+
'properties' => {
|
104
|
+
'key' => { 'type' => 'integer', 'format' => 'int32', 'readOnly' => true },
|
105
|
+
'in_body_1' => { 'type' => 'integer', 'format' => 'int32', 'description' => 'in_body_1' },
|
106
|
+
'in_body_2' => { 'type' => 'string', 'description' => 'in_body_2' },
|
107
|
+
'in_body_3' => { 'type' => 'string', 'description' => 'in_body_3' }
|
108
|
+
})
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
@@ -116,36 +116,36 @@ describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `h
|
|
116
116
|
end
|
117
117
|
|
118
118
|
specify do
|
119
|
-
expect(subject['paths']['/with_entities/in_body']['post']['parameters']).to eql(
|
120
|
-
|
121
|
-
|
119
|
+
expect(subject['paths']['/with_entities/in_body']['post']['parameters']).to eql(
|
120
|
+
[
|
121
|
+
{ 'name' => 'ResponseItem', 'in' => 'body', 'required' => true, 'schema' => { '$ref' => '#/definitions/postRequestResponseItem' } }
|
122
|
+
])
|
122
123
|
end
|
123
124
|
|
124
125
|
specify do
|
125
|
-
expect(subject['definitions']['postRequestResponseItem']).to eql(
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
})
|
126
|
+
expect(subject['definitions']['postRequestResponseItem']).to eql(
|
127
|
+
'description' => 'post in body with entity',
|
128
|
+
'type' => 'object',
|
129
|
+
'properties' => {
|
130
|
+
'name' => { 'type' => 'string', 'description' => 'name' } },
|
131
|
+
'required' => ['name'])
|
132
132
|
end
|
133
133
|
|
134
134
|
specify do
|
135
|
-
expect(subject['paths']['/with_entities/in_body/{id}']['put']['parameters']).to eql(
|
136
|
-
|
137
|
-
|
138
|
-
|
135
|
+
expect(subject['paths']['/with_entities/in_body/{id}']['put']['parameters']).to eql(
|
136
|
+
[
|
137
|
+
{ 'in' => 'path', 'name' => 'id', 'type' => 'integer', 'format' => 'int32', 'required' => true },
|
138
|
+
{ 'name' => 'ResponseItem', 'in' => 'body', 'required' => true, 'schema' => { '$ref' => '#/definitions/putRequestResponseItem' } }
|
139
|
+
])
|
139
140
|
end
|
140
141
|
|
141
142
|
specify do
|
142
|
-
expect(subject['definitions']['putRequestResponseItem']).to eql(
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
})
|
143
|
+
expect(subject['definitions']['putRequestResponseItem']).to eql(
|
144
|
+
'description' => 'put in body with entity',
|
145
|
+
'type' => 'object',
|
146
|
+
'properties' => {
|
147
|
+
'id' => { 'type' => 'integer', 'format' => 'int32', 'readOnly' => true },
|
148
|
+
'name' => { 'type' => 'string', 'description' => 'name' } })
|
149
149
|
end
|
150
150
|
end
|
151
151
|
end
|
@@ -1,25 +1,25 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `header`' do
|
4
|
-
include_context
|
4
|
+
include_context 'the api entities'
|
5
5
|
|
6
6
|
before :all do
|
7
7
|
module TheApi
|
8
8
|
class ParamTypeApi < Grape::API
|
9
9
|
# using `:param_type`
|
10
10
|
desc 'full set of request param types',
|
11
|
-
|
11
|
+
success: TheApi::Entities::UseResponse
|
12
12
|
params do
|
13
13
|
optional :in_query, type: String, documentation: { param_type: 'query' }
|
14
14
|
optional :in_header, type: String, documentation: { param_type: 'header' }
|
15
15
|
end
|
16
16
|
|
17
17
|
get '/defined_param_type' do
|
18
|
-
{
|
18
|
+
{ 'declared_params' => declared(params) }
|
19
19
|
end
|
20
20
|
|
21
21
|
desc 'full set of request param types',
|
22
|
-
|
22
|
+
success: TheApi::Entities::UseResponse
|
23
23
|
params do
|
24
24
|
requires :in_path, type: Integer
|
25
25
|
optional :in_query, type: String, documentation: { param_type: 'query' }
|
@@ -27,11 +27,11 @@ describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `h
|
|
27
27
|
end
|
28
28
|
|
29
29
|
get '/defined_param_type/:in_path' do
|
30
|
-
{
|
30
|
+
{ 'declared_params' => declared(params) }
|
31
31
|
end
|
32
32
|
|
33
33
|
desc 'full set of request param types',
|
34
|
-
|
34
|
+
success: TheApi::Entities::UseResponse
|
35
35
|
params do
|
36
36
|
optional :in_path, type: Integer
|
37
37
|
optional :in_query, type: String, documentation: { param_type: 'query' }
|
@@ -39,23 +39,23 @@ describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `h
|
|
39
39
|
end
|
40
40
|
|
41
41
|
delete '/defined_param_type/:in_path' do
|
42
|
-
{
|
42
|
+
{ 'declared_params' => declared(params) }
|
43
43
|
end
|
44
44
|
|
45
45
|
# using `:in`
|
46
46
|
desc 'full set of request param types using `:in`',
|
47
|
-
|
47
|
+
success: TheApi::Entities::UseResponse
|
48
48
|
params do
|
49
49
|
optional :in_query, type: String, documentation: { in: 'query' }
|
50
50
|
optional :in_header, type: String, documentation: { in: 'header' }
|
51
51
|
end
|
52
52
|
|
53
53
|
get '/defined_in' do
|
54
|
-
{
|
54
|
+
{ 'declared_params' => declared(params) }
|
55
55
|
end
|
56
56
|
|
57
57
|
desc 'full set of request param types using `:in`',
|
58
|
-
|
58
|
+
success: TheApi::Entities::UseResponse
|
59
59
|
params do
|
60
60
|
requires :in_path, type: Integer
|
61
61
|
optional :in_query, type: String, documentation: { in: 'query' }
|
@@ -63,7 +63,7 @@ describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `h
|
|
63
63
|
end
|
64
64
|
|
65
65
|
get '/defined_in/:in_path' do
|
66
|
-
{
|
66
|
+
{ 'declared_params' => declared(params) }
|
67
67
|
end
|
68
68
|
|
69
69
|
desc 'full set of request param types using `:in`'
|
@@ -74,31 +74,30 @@ describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `h
|
|
74
74
|
end
|
75
75
|
|
76
76
|
delete '/defined_in/:in_path' do
|
77
|
-
{
|
77
|
+
{ 'declared_params' => declared(params) }
|
78
78
|
end
|
79
79
|
|
80
80
|
# file
|
81
81
|
desc 'file download',
|
82
|
-
|
82
|
+
success: TheApi::Entities::UseResponse
|
83
83
|
params do
|
84
84
|
requires :name, type: String
|
85
85
|
end
|
86
86
|
|
87
87
|
get '/download' do
|
88
|
-
{
|
88
|
+
{ 'declared_params' => declared(params) }
|
89
89
|
end
|
90
90
|
|
91
91
|
desc 'file upload',
|
92
|
-
|
92
|
+
success: TheApi::Entities::UseResponse
|
93
93
|
params do
|
94
94
|
requires :name, type: File
|
95
95
|
end
|
96
96
|
|
97
97
|
post '/upload' do
|
98
|
-
{
|
98
|
+
{ 'declared_params' => declared(params) }
|
99
99
|
end
|
100
100
|
|
101
|
-
|
102
101
|
add_swagger_documentation
|
103
102
|
end
|
104
103
|
end
|
@@ -115,15 +114,16 @@ describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `h
|
|
115
114
|
end
|
116
115
|
|
117
116
|
specify do
|
118
|
-
expect(subject['paths']['/defined_param_type/{in_path}']['delete']['responses']).to eql(
|
119
|
-
|
120
|
-
|
117
|
+
expect(subject['paths']['/defined_param_type/{in_path}']['delete']['responses']).to eql(
|
118
|
+
'200' => {
|
119
|
+
'description' => 'full set of request param types',
|
120
|
+
'schema' => { '$ref' => '#/definitions/UseResponse' } })
|
121
121
|
end
|
122
122
|
|
123
123
|
specify do
|
124
|
-
expect(subject['paths']['/defined_in/{in_path}']['delete']['responses']).to eql(
|
125
|
-
|
126
|
-
|
124
|
+
expect(subject['paths']['/defined_in/{in_path}']['delete']['responses']).to eql(
|
125
|
+
'204' => {
|
126
|
+
'description' => 'full set of request param types using `:in`' })
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -134,26 +134,29 @@ describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `h
|
|
134
134
|
end
|
135
135
|
|
136
136
|
specify do
|
137
|
-
expect(subject['paths']['/defined_param_type']['get']['parameters']).to eql(
|
138
|
-
|
139
|
-
|
140
|
-
|
137
|
+
expect(subject['paths']['/defined_param_type']['get']['parameters']).to eql(
|
138
|
+
[
|
139
|
+
{ 'in' => 'query', 'name' => 'in_query', 'required' => false, 'type' => 'string' },
|
140
|
+
{ 'in' => 'header', 'name' => 'in_header', 'required' => false, 'type' => 'string' }
|
141
|
+
])
|
141
142
|
end
|
142
143
|
|
143
144
|
specify do
|
144
|
-
expect(subject['paths']['/defined_param_type/{in_path}']['get']['parameters']).to eql(
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
145
|
+
expect(subject['paths']['/defined_param_type/{in_path}']['get']['parameters']).to eql(
|
146
|
+
[
|
147
|
+
{ 'in' => 'path', 'name' => 'in_path', 'required' => true, 'type' => 'integer', 'format' => 'int32' },
|
148
|
+
{ 'in' => 'query', 'name' => 'in_query', 'required' => false, 'type' => 'string' },
|
149
|
+
{ 'in' => 'header', 'name' => 'in_header', 'required' => false, 'type' => 'string' }
|
150
|
+
])
|
149
151
|
end
|
150
152
|
|
151
153
|
specify do
|
152
|
-
expect(subject['paths']['/defined_param_type/{in_path}']['delete']['parameters']).to eql(
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
154
|
+
expect(subject['paths']['/defined_param_type/{in_path}']['delete']['parameters']).to eql(
|
155
|
+
[
|
156
|
+
{ 'in' => 'path', 'name' => 'in_path', 'required' => true, 'type' => 'integer', 'format' => 'int32' },
|
157
|
+
{ 'in' => 'query', 'name' => 'in_query', 'required' => false, 'type' => 'string' },
|
158
|
+
{ 'in' => 'header', 'name' => 'in_header', 'required' => false, 'type' => 'string' }
|
159
|
+
])
|
157
160
|
end
|
158
161
|
end
|
159
162
|
|
@@ -164,26 +167,29 @@ describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `h
|
|
164
167
|
end
|
165
168
|
|
166
169
|
specify do
|
167
|
-
expect(subject['paths']['/defined_in']['get']['parameters']).to eql(
|
168
|
-
|
169
|
-
|
170
|
-
|
170
|
+
expect(subject['paths']['/defined_in']['get']['parameters']).to eql(
|
171
|
+
[
|
172
|
+
{ 'in' => 'query', 'name' => 'in_query', 'required' => false, 'type' => 'string' },
|
173
|
+
{ 'in' => 'header', 'name' => 'in_header', 'required' => false, 'type' => 'string' }
|
174
|
+
])
|
171
175
|
end
|
172
176
|
|
173
177
|
specify do
|
174
|
-
expect(subject['paths']['/defined_in/{in_path}']['get']['parameters']).to eql(
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
178
|
+
expect(subject['paths']['/defined_in/{in_path}']['get']['parameters']).to eql(
|
179
|
+
[
|
180
|
+
{ 'in' => 'path', 'name' => 'in_path', 'required' => true, 'type' => 'integer', 'format' => 'int32' },
|
181
|
+
{ 'in' => 'query', 'name' => 'in_query', 'required' => false, 'type' => 'string' },
|
182
|
+
{ 'in' => 'header', 'name' => 'in_header', 'required' => false, 'type' => 'string' }
|
183
|
+
])
|
179
184
|
end
|
180
185
|
|
181
186
|
specify do
|
182
|
-
expect(subject['paths']['/defined_in/{in_path}']['delete']['parameters']).to eql(
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
+
expect(subject['paths']['/defined_in/{in_path}']['delete']['parameters']).to eql(
|
188
|
+
[
|
189
|
+
{ 'in' => 'path', 'name' => 'in_path', 'required' => true, 'type' => 'integer', 'format' => 'int32' },
|
190
|
+
{ 'in' => 'query', 'name' => 'in_query', 'required' => false, 'type' => 'string' },
|
191
|
+
{ 'in' => 'header', 'name' => 'in_header', 'required' => false, 'type' => 'string' }
|
192
|
+
])
|
187
193
|
end
|
188
194
|
end
|
189
195
|
|
@@ -195,9 +201,10 @@ describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `h
|
|
195
201
|
end
|
196
202
|
|
197
203
|
specify do
|
198
|
-
expect(subject['paths']['/upload']['post']['parameters']).to eql(
|
199
|
-
|
200
|
-
|
204
|
+
expect(subject['paths']['/upload']['post']['parameters']).to eql(
|
205
|
+
[
|
206
|
+
{ 'in' => 'formData', 'name' => 'name', 'required' => true, 'type' => 'file' }
|
207
|
+
])
|
201
208
|
end
|
202
209
|
end
|
203
210
|
|
@@ -208,9 +215,10 @@ describe 'setting of param type, such as `query`, `path`, `formData`, `body`, `h
|
|
208
215
|
end
|
209
216
|
|
210
217
|
specify do
|
211
|
-
expect(subject['paths']['/download']['get']['parameters']).to eql(
|
212
|
-
|
213
|
-
|
218
|
+
expect(subject['paths']['/download']['get']['parameters']).to eql(
|
219
|
+
[
|
220
|
+
{ 'in' => 'query', 'name' => 'name', 'required' => true, 'type' => 'string' }
|
221
|
+
])
|
214
222
|
end
|
215
223
|
end
|
216
224
|
end
|
@@ -10,22 +10,22 @@ describe 'additional parameter settings' do
|
|
10
10
|
optional :name, type: String
|
11
11
|
end
|
12
12
|
put ':id' do
|
13
|
-
{
|
13
|
+
{ 'declared_params' => declared(params) }
|
14
14
|
end
|
15
15
|
|
16
16
|
desc 'Get booking details'
|
17
17
|
get ':id' do
|
18
|
-
{
|
18
|
+
{ 'declared_params' => declared(params) }
|
19
19
|
end
|
20
20
|
|
21
21
|
desc 'Get booking details by access_number'
|
22
22
|
get '/conf/:access_number' do
|
23
|
-
{
|
23
|
+
{ 'declared_params' => declared(params) }
|
24
24
|
end
|
25
25
|
|
26
26
|
desc 'Remove booking'
|
27
27
|
delete ':id' do
|
28
|
-
{
|
28
|
+
{ 'declared_params' => declared(params) }
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -44,21 +44,24 @@ describe 'additional parameter settings' do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
specify do
|
47
|
-
expect(subject['paths']['/bookings/{id}']['put']['parameters']).to eql(
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
expect(subject['paths']['/bookings/{id}']['put']['parameters'].sort_by { |p| p['name'] }).to eql(
|
48
|
+
[
|
49
|
+
{ 'in' => 'path', 'name' => 'id', 'type' => 'integer', 'format' => 'int32', 'required' => true },
|
50
|
+
{ 'in' => 'formData', 'name' => 'name', 'type' => 'string', 'required' => false }
|
51
|
+
])
|
51
52
|
end
|
52
53
|
|
53
54
|
specify do
|
54
|
-
expect(subject['paths']['/bookings/{id}']['get']['parameters']).to eql(
|
55
|
-
|
56
|
-
|
55
|
+
expect(subject['paths']['/bookings/{id}']['get']['parameters']).to eql(
|
56
|
+
[
|
57
|
+
{ 'in' => 'path', 'name' => 'id', 'type' => 'integer', 'format' => 'int32', 'required' => true }
|
58
|
+
])
|
57
59
|
end
|
58
60
|
|
59
61
|
specify do
|
60
|
-
expect(subject['paths']['/bookings/{id}']['delete']['parameters']).to eql(
|
61
|
-
|
62
|
-
|
62
|
+
expect(subject['paths']['/bookings/{id}']['delete']['parameters']).to eql(
|
63
|
+
[
|
64
|
+
{ 'in' => 'path', 'name' => 'id', 'type' => 'integer', 'format' => 'int32', 'required' => true }
|
65
|
+
])
|
63
66
|
end
|
64
67
|
end
|