gitlab-grape-swagger 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.github/dependabot.yml +20 -0
- data/.github/workflows/ci.yml +45 -0
- data/.gitignore +44 -0
- data/.gitlab-ci.yml +19 -0
- data/.rspec +3 -0
- data/.rubocop.yml +136 -0
- data/.rubocop_todo.yml +60 -0
- data/.ruby-gemset +1 -0
- data/CHANGELOG.md +671 -0
- data/CONTRIBUTING.md +126 -0
- data/Dangerfile +3 -0
- data/Gemfile +45 -0
- data/Gemfile.lock +249 -0
- data/LICENSE.txt +20 -0
- data/README.md +1772 -0
- data/RELEASING.md +82 -0
- data/Rakefile +20 -0
- data/UPGRADING.md +201 -0
- data/example/api/endpoints.rb +131 -0
- data/example/api/entities.rb +18 -0
- data/example/config.ru +42 -0
- data/example/example_requests.postman_collection +146 -0
- data/example/splines.png +0 -0
- data/example/swagger-example.png +0 -0
- data/grape-swagger.gemspec +23 -0
- data/lib/grape-swagger/doc_methods/build_model_definition.rb +68 -0
- data/lib/grape-swagger/doc_methods/data_type.rb +110 -0
- data/lib/grape-swagger/doc_methods/extensions.rb +101 -0
- data/lib/grape-swagger/doc_methods/file_params.rb +17 -0
- data/lib/grape-swagger/doc_methods/format_data.rb +53 -0
- data/lib/grape-swagger/doc_methods/headers.rb +20 -0
- data/lib/grape-swagger/doc_methods/move_params.rb +209 -0
- data/lib/grape-swagger/doc_methods/operation_id.rb +32 -0
- data/lib/grape-swagger/doc_methods/optional_object.rb +30 -0
- data/lib/grape-swagger/doc_methods/parse_params.rb +190 -0
- data/lib/grape-swagger/doc_methods/path_string.rb +52 -0
- data/lib/grape-swagger/doc_methods/produces_consumes.rb +15 -0
- data/lib/grape-swagger/doc_methods/status_codes.rb +21 -0
- data/lib/grape-swagger/doc_methods/tag_name_description.rb +34 -0
- data/lib/grape-swagger/doc_methods/version.rb +20 -0
- data/lib/grape-swagger/doc_methods.rb +142 -0
- data/lib/grape-swagger/endpoint/params_parser.rb +76 -0
- data/lib/grape-swagger/endpoint.rb +476 -0
- data/lib/grape-swagger/errors.rb +17 -0
- data/lib/grape-swagger/instance.rb +7 -0
- data/lib/grape-swagger/model_parsers.rb +42 -0
- data/lib/grape-swagger/rake/oapi_tasks.rb +135 -0
- data/lib/grape-swagger/version.rb +5 -0
- data/lib/grape-swagger.rb +174 -0
- data/spec/issues/267_nested_namespaces.rb +55 -0
- data/spec/issues/403_versions_spec.rb +124 -0
- data/spec/issues/427_entity_as_string_spec.rb +39 -0
- data/spec/issues/430_entity_definitions_spec.rb +94 -0
- data/spec/issues/532_allow_custom_format_spec.rb +42 -0
- data/spec/issues/533_specify_status_code_spec.rb +78 -0
- data/spec/issues/537_enum_values_spec.rb +50 -0
- data/spec/issues/539_array_post_body_spec.rb +65 -0
- data/spec/issues/542_array_of_type_in_post_body_spec.rb +46 -0
- data/spec/issues/553_align_array_put_post_params_spec.rb +152 -0
- data/spec/issues/572_array_post_body_spec.rb +51 -0
- data/spec/issues/579_align_put_post_parameters_spec.rb +185 -0
- data/spec/issues/582_file_response_spec.rb +55 -0
- data/spec/issues/587_range_parameter_delimited_by_dash_spec.rb +26 -0
- data/spec/issues/605_root_route_documentation_spec.rb +23 -0
- data/spec/issues/650_params_array_spec.rb +65 -0
- data/spec/issues/677_consumes_produces_add_swagger_documentation_options_spec.rb +100 -0
- data/spec/issues/680_keep_204_error_schemas_spec.rb +55 -0
- data/spec/issues/721_set_default_parameter_location_based_on_consumes_spec.rb +62 -0
- data/spec/issues/751_deeply_nested_objects_spec.rb +190 -0
- data/spec/issues/776_multiple_presents_spec.rb +59 -0
- data/spec/issues/784_extensions_on_params_spec.rb +42 -0
- data/spec/issues/809_utf8_routes_spec.rb +55 -0
- data/spec/issues/832_array_hash_float_decimal_spec.rb +114 -0
- data/spec/issues/847_route_param_options_spec.rb +37 -0
- data/spec/issues/873_wildcard_segments_path_parameters_spec.rb +28 -0
- data/spec/issues/878_optional_path_segments_spec.rb +29 -0
- data/spec/issues/881_handle_file_params_spec.rb +38 -0
- data/spec/issues/883_query_array_parameter_spec.rb +46 -0
- data/spec/issues/884_dont_document_non_schema_examples_spec.rb +49 -0
- data/spec/issues/887_prevent_duplicate_operation_ids_spec.rb +35 -0
- data/spec/lib/data_type_spec.rb +111 -0
- data/spec/lib/endpoint/params_parser_spec.rb +124 -0
- data/spec/lib/endpoint_spec.rb +153 -0
- data/spec/lib/extensions_spec.rb +185 -0
- data/spec/lib/format_data_spec.rb +115 -0
- data/spec/lib/model_parsers_spec.rb +104 -0
- data/spec/lib/move_params_spec.rb +444 -0
- data/spec/lib/oapi_tasks_spec.rb +163 -0
- data/spec/lib/operation_id_spec.rb +55 -0
- data/spec/lib/optional_object_spec.rb +47 -0
- data/spec/lib/parse_params_spec.rb +68 -0
- data/spec/lib/path_string_spec.rb +101 -0
- data/spec/lib/produces_consumes_spec.rb +116 -0
- data/spec/lib/tag_name_description_spec.rb +80 -0
- data/spec/lib/version_spec.rb +28 -0
- data/spec/spec_helper.rb +39 -0
- data/spec/support/empty_model_parser.rb +23 -0
- data/spec/support/grape_version.rb +13 -0
- data/spec/support/mock_parser.rb +23 -0
- data/spec/support/model_parsers/entity_parser.rb +334 -0
- data/spec/support/model_parsers/mock_parser.rb +346 -0
- data/spec/support/model_parsers/representable_parser.rb +406 -0
- data/spec/support/namespace_tags.rb +93 -0
- data/spec/support/the_paths_definitions.rb +109 -0
- data/spec/swagger_v2/api_documentation_spec.rb +42 -0
- data/spec/swagger_v2/api_swagger_v2_additional_properties_spec.rb +83 -0
- data/spec/swagger_v2/api_swagger_v2_body_definitions_spec.rb +48 -0
- data/spec/swagger_v2/api_swagger_v2_definitions-models_spec.rb +36 -0
- data/spec/swagger_v2/api_swagger_v2_detail_spec.rb +79 -0
- data/spec/swagger_v2/api_swagger_v2_extensions_spec.rb +145 -0
- data/spec/swagger_v2/api_swagger_v2_format-content_type_spec.rb +137 -0
- data/spec/swagger_v2/api_swagger_v2_global_configuration_spec.rb +56 -0
- data/spec/swagger_v2/api_swagger_v2_hash_and_array_spec.rb +64 -0
- data/spec/swagger_v2/api_swagger_v2_headers_spec.rb +58 -0
- data/spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb +57 -0
- data/spec/swagger_v2/api_swagger_v2_hide_param_spec.rb +109 -0
- data/spec/swagger_v2/api_swagger_v2_ignore_defaults_spec.rb +48 -0
- data/spec/swagger_v2/api_swagger_v2_mounted_spec.rb +153 -0
- data/spec/swagger_v2/api_swagger_v2_param_type_body_nested_spec.rb +355 -0
- data/spec/swagger_v2/api_swagger_v2_param_type_body_spec.rb +217 -0
- data/spec/swagger_v2/api_swagger_v2_param_type_spec.rb +247 -0
- data/spec/swagger_v2/api_swagger_v2_request_params_fix_spec.rb +80 -0
- data/spec/swagger_v2/api_swagger_v2_response_spec.rb +147 -0
- data/spec/swagger_v2/api_swagger_v2_response_with_examples_spec.rb +135 -0
- data/spec/swagger_v2/api_swagger_v2_response_with_headers_spec.rb +216 -0
- data/spec/swagger_v2/api_swagger_v2_response_with_models_spec.rb +53 -0
- data/spec/swagger_v2/api_swagger_v2_response_with_root_spec.rb +153 -0
- data/spec/swagger_v2/api_swagger_v2_spec.rb +245 -0
- data/spec/swagger_v2/api_swagger_v2_status_codes_spec.rb +93 -0
- data/spec/swagger_v2/api_swagger_v2_type-format_spec.rb +90 -0
- data/spec/swagger_v2/boolean_params_spec.rb +38 -0
- data/spec/swagger_v2/default_api_spec.rb +175 -0
- data/spec/swagger_v2/deprecated_field_spec.rb +25 -0
- data/spec/swagger_v2/description_not_initialized_spec.rb +39 -0
- data/spec/swagger_v2/endpoint_versioned_path_spec.rb +130 -0
- data/spec/swagger_v2/errors_spec.rb +77 -0
- data/spec/swagger_v2/float_api_spec.rb +36 -0
- data/spec/swagger_v2/form_params_spec.rb +76 -0
- data/spec/swagger_v2/grape-swagger_spec.rb +17 -0
- data/spec/swagger_v2/guarded_endpoint_spec.rb +162 -0
- data/spec/swagger_v2/hide_api_spec.rb +147 -0
- data/spec/swagger_v2/host_spec.rb +43 -0
- data/spec/swagger_v2/inheritance_and_discriminator_spec.rb +57 -0
- data/spec/swagger_v2/mount_override_api_spec.rb +58 -0
- data/spec/swagger_v2/mounted_target_class_spec.rb +76 -0
- data/spec/swagger_v2/namespace_tags_prefix_spec.rb +122 -0
- data/spec/swagger_v2/namespace_tags_spec.rb +78 -0
- data/spec/swagger_v2/namespaced_api_spec.rb +121 -0
- data/spec/swagger_v2/nicknamed_api_spec.rb +25 -0
- data/spec/swagger_v2/operation_id_api_spec.rb +27 -0
- data/spec/swagger_v2/param_multi_type_spec.rb +82 -0
- data/spec/swagger_v2/param_type_spec.rb +95 -0
- data/spec/swagger_v2/param_values_spec.rb +180 -0
- data/spec/swagger_v2/params_array_collection_format_spec.rb +105 -0
- data/spec/swagger_v2/params_array_spec.rb +225 -0
- data/spec/swagger_v2/params_example_spec.rb +38 -0
- data/spec/swagger_v2/params_hash_spec.rb +77 -0
- data/spec/swagger_v2/params_nested_spec.rb +92 -0
- data/spec/swagger_v2/parent_less_namespace_spec.rb +32 -0
- data/spec/swagger_v2/reference_entity_spec.rb +129 -0
- data/spec/swagger_v2/security_requirement_spec.rb +46 -0
- data/spec/swagger_v2/simple_mounted_api_spec.rb +332 -0
- data/spec/version_spec.rb +10 -0
- metadata +225 -0
@@ -0,0 +1,346 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.shared_context 'mock swagger example' do
|
4
|
+
before :all do
|
5
|
+
module Entities
|
6
|
+
class Something < OpenStruct
|
7
|
+
class << self
|
8
|
+
# Representable doesn't have documentation method, mock this
|
9
|
+
def documentation
|
10
|
+
{
|
11
|
+
id: { type: Integer, desc: 'Identity of Something' },
|
12
|
+
text: { type: String, desc: 'Content of something.' },
|
13
|
+
links: { type: 'link', is_array: true },
|
14
|
+
others: { type: 'text', is_array: false }
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class UseResponse < OpenStruct
|
21
|
+
class << self
|
22
|
+
def documentation
|
23
|
+
{
|
24
|
+
:description => { type: String },
|
25
|
+
'$responses' => { is_array: true }
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class ResponseItem < OpenStruct
|
32
|
+
class << self
|
33
|
+
def documentation
|
34
|
+
{
|
35
|
+
id: { type: Integer },
|
36
|
+
name: { type: String }
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class UseNestedWithAddress < OpenStruct; end
|
43
|
+
|
44
|
+
class TypedDefinition < OpenStruct; end
|
45
|
+
|
46
|
+
class UseItemResponseAsType < OpenStruct; end
|
47
|
+
|
48
|
+
class OtherItem < OpenStruct; end
|
49
|
+
|
50
|
+
class EnumValues < OpenStruct; end
|
51
|
+
|
52
|
+
class AliasedThing < OpenStruct; end
|
53
|
+
|
54
|
+
class FourthLevel < OpenStruct; end
|
55
|
+
|
56
|
+
class ThirdLevel < OpenStruct; end
|
57
|
+
|
58
|
+
class SecondLevel < OpenStruct; end
|
59
|
+
|
60
|
+
class FirstLevel < OpenStruct; end
|
61
|
+
|
62
|
+
class QueryInputElement < OpenStruct; end
|
63
|
+
|
64
|
+
class QueryInput < OpenStruct; end
|
65
|
+
|
66
|
+
class ApiError < OpenStruct; end
|
67
|
+
|
68
|
+
class SecondApiError < OpenStruct; end
|
69
|
+
|
70
|
+
class RecursiveModel < OpenStruct; end
|
71
|
+
|
72
|
+
class DocumentedHashAndArrayModel < OpenStruct; end
|
73
|
+
|
74
|
+
module NestedModule
|
75
|
+
class ApiResponse < OpenStruct; end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
let(:swagger_definitions_models) do
|
81
|
+
{
|
82
|
+
'ApiError' => {
|
83
|
+
'type' => 'object',
|
84
|
+
'properties' => {
|
85
|
+
'mock_data' => {
|
86
|
+
'type' => 'string',
|
87
|
+
'description' => "it's a mock"
|
88
|
+
}
|
89
|
+
}
|
90
|
+
},
|
91
|
+
'RecursiveModel' => {
|
92
|
+
'type' => 'object',
|
93
|
+
'properties' => {
|
94
|
+
'mock_data' => {
|
95
|
+
'type' => 'string',
|
96
|
+
'description' => "it's a mock"
|
97
|
+
}
|
98
|
+
}
|
99
|
+
},
|
100
|
+
'UseResponse' => {
|
101
|
+
'type' => 'object',
|
102
|
+
'properties' => {
|
103
|
+
'mock_data' => {
|
104
|
+
'type' => 'string',
|
105
|
+
'description' => "it's a mock"
|
106
|
+
}
|
107
|
+
}
|
108
|
+
},
|
109
|
+
'DocumentedHashAndArrayModel' => {
|
110
|
+
'type' => 'object',
|
111
|
+
'properties' => {
|
112
|
+
'mock_data' => {
|
113
|
+
'type' => 'string',
|
114
|
+
'description' => "it's a mock"
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
end
|
120
|
+
|
121
|
+
let(:swagger_nested_type) do
|
122
|
+
{
|
123
|
+
'ApiError' => {
|
124
|
+
'type' => 'object',
|
125
|
+
'properties' => {
|
126
|
+
'mock_data' => {
|
127
|
+
'type' => 'string',
|
128
|
+
'description' => "it's a mock"
|
129
|
+
}
|
130
|
+
},
|
131
|
+
'description' => 'ApiError model'
|
132
|
+
},
|
133
|
+
'UseItemResponseAsType' => {
|
134
|
+
'type' => 'object',
|
135
|
+
'properties' => {
|
136
|
+
'mock_data' => {
|
137
|
+
'type' => 'string',
|
138
|
+
'description' => "it's a mock"
|
139
|
+
}
|
140
|
+
},
|
141
|
+
'description' => 'UseItemResponseAsType model'
|
142
|
+
}
|
143
|
+
}
|
144
|
+
end
|
145
|
+
|
146
|
+
let(:swagger_entity_as_response_object) do
|
147
|
+
{
|
148
|
+
'UseResponse' => {
|
149
|
+
'type' => 'object',
|
150
|
+
'properties' => {
|
151
|
+
'mock_data' => {
|
152
|
+
'type' => 'string',
|
153
|
+
'description' => "it's a mock"
|
154
|
+
}
|
155
|
+
},
|
156
|
+
'description' => 'UseResponse model'
|
157
|
+
},
|
158
|
+
'ApiError' => {
|
159
|
+
'type' => 'object',
|
160
|
+
'properties' => {
|
161
|
+
'mock_data' => {
|
162
|
+
'type' => 'string',
|
163
|
+
'description' => "it's a mock"
|
164
|
+
}
|
165
|
+
},
|
166
|
+
'description' => 'ApiError model'
|
167
|
+
}
|
168
|
+
}
|
169
|
+
end
|
170
|
+
|
171
|
+
let(:swagger_params_as_response_object) do
|
172
|
+
{
|
173
|
+
'ApiError' => {
|
174
|
+
'type' => 'object',
|
175
|
+
'properties' => {
|
176
|
+
'mock_data' => {
|
177
|
+
'type' => 'string',
|
178
|
+
'description' => "it's a mock"
|
179
|
+
}
|
180
|
+
},
|
181
|
+
'description' => 'ApiError model'
|
182
|
+
}
|
183
|
+
}
|
184
|
+
end
|
185
|
+
|
186
|
+
let(:swagger_typed_defintion) do
|
187
|
+
{
|
188
|
+
'mock_data' => {
|
189
|
+
'type' => 'string',
|
190
|
+
'description' => "it's a mock"
|
191
|
+
}
|
192
|
+
}
|
193
|
+
end
|
194
|
+
|
195
|
+
let(:swagger_json) do
|
196
|
+
{
|
197
|
+
'info' => {
|
198
|
+
'title' => 'The API title to be displayed on the API homepage.',
|
199
|
+
'description' => 'A description of the API.',
|
200
|
+
'termsOfService' => 'www.The-URL-of-the-terms-and-service.com',
|
201
|
+
'contact' => { 'name' => 'Contact name', 'email' => 'Contact@email.com', 'url' => 'Contact URL' },
|
202
|
+
'license' => { 'name' => 'The name of the license.', 'url' => 'www.The-URL-of-the-license.org' },
|
203
|
+
'version' => '0.0.1'
|
204
|
+
},
|
205
|
+
'swagger' => '2.0',
|
206
|
+
'produces' => ['application/json'],
|
207
|
+
'host' => 'example.org',
|
208
|
+
'basePath' => '/api',
|
209
|
+
'tags' => [
|
210
|
+
{ 'name' => 'other_thing', 'description' => 'Operations about other_things' },
|
211
|
+
{ 'name' => 'thing', 'description' => 'Operations about things' },
|
212
|
+
{ 'name' => 'thing2', 'description' => 'Operations about thing2s' },
|
213
|
+
{ 'name' => 'dummy', 'description' => 'Operations about dummies' }
|
214
|
+
],
|
215
|
+
'paths' => {
|
216
|
+
'/v3/other_thing/{elements}' => {
|
217
|
+
'get' => {
|
218
|
+
'description' => 'nested route inside namespace',
|
219
|
+
'produces' => ['application/json'],
|
220
|
+
'parameters' => [{ 'in' => 'body', 'name' => 'elements', 'description' => 'Set of configuration', 'type' => 'array', 'items' => { 'type' => 'string' }, 'required' => true }],
|
221
|
+
'responses' => { '200' => { 'description' => 'nested route inside namespace', 'schema' => { '$ref' => '#/definitions/QueryInput' } } },
|
222
|
+
'tags' => ['other_thing'],
|
223
|
+
'operationId' => 'getV3OtherThingElements',
|
224
|
+
'x-amazon-apigateway-auth' => { 'type' => 'none' },
|
225
|
+
'x-amazon-apigateway-integration' => { 'type' => 'aws', 'uri' => 'foo_bar_uri', 'httpMethod' => 'get' }
|
226
|
+
}
|
227
|
+
},
|
228
|
+
'/thing' => {
|
229
|
+
'get' => {
|
230
|
+
'description' => 'This gets Things.',
|
231
|
+
'produces' => ['application/json'],
|
232
|
+
'parameters' => [
|
233
|
+
{ 'in' => 'query', 'name' => 'id', 'description' => 'Identity of Something', 'type' => 'integer', 'format' => 'int32', 'required' => false },
|
234
|
+
{ 'in' => 'query', 'name' => 'text', 'description' => 'Content of something.', 'type' => 'string', 'required' => false },
|
235
|
+
{ 'in' => 'formData', 'name' => 'links', 'type' => 'array', 'items' => { 'type' => 'link' }, 'required' => false },
|
236
|
+
{ 'in' => 'query', 'name' => 'others', 'type' => 'text', 'required' => false }
|
237
|
+
],
|
238
|
+
'responses' => { '200' => { 'description' => 'This gets Things.' }, '401' => { 'description' => 'Unauthorized', 'schema' => { '$ref' => '#/definitions/ApiError' } } },
|
239
|
+
'tags' => ['thing'],
|
240
|
+
'operationId' => 'getThing'
|
241
|
+
},
|
242
|
+
'post' => {
|
243
|
+
'description' => 'This creates Thing.',
|
244
|
+
'produces' => ['application/json'],
|
245
|
+
'consumes' => ['application/x-www-form-urlencoded'],
|
246
|
+
'parameters' => [
|
247
|
+
{ 'in' => 'formData', 'name' => 'text', 'description' => 'Content of something.', 'type' => 'string', 'required' => true },
|
248
|
+
{ 'in' => 'formData', 'name' => 'links', 'type' => 'array', 'items' => { 'type' => 'string' }, 'required' => true }
|
249
|
+
],
|
250
|
+
'responses' => { '201' => { 'description' => 'This creates Thing.', 'schema' => { '$ref' => '#/definitions/Something' } }, '422' => { 'description' => 'Unprocessible Entity' } },
|
251
|
+
'tags' => ['thing'],
|
252
|
+
'operationId' => 'postThing'
|
253
|
+
}
|
254
|
+
},
|
255
|
+
'/thing/{id}' => {
|
256
|
+
'get' => {
|
257
|
+
'description' => 'This gets Thing.',
|
258
|
+
'produces' => ['application/json'],
|
259
|
+
'parameters' => [{ 'in' => 'path', 'name' => 'id', 'type' => 'integer', 'format' => 'int32', 'required' => true }],
|
260
|
+
'responses' => { '200' => { 'description' => 'getting a single thing' }, '401' => { 'description' => 'Unauthorized' } },
|
261
|
+
'tags' => ['thing'],
|
262
|
+
'operationId' => 'getThingId'
|
263
|
+
},
|
264
|
+
'put' => {
|
265
|
+
'description' => 'This updates Thing.',
|
266
|
+
'produces' => ['application/json'],
|
267
|
+
'consumes' => ['application/x-www-form-urlencoded'],
|
268
|
+
'parameters' => [
|
269
|
+
{ 'in' => 'path', 'name' => 'id', 'type' => 'integer', 'format' => 'int32', 'required' => true },
|
270
|
+
{ 'in' => 'formData', 'name' => 'text', 'description' => 'Content of something.', 'type' => 'string', 'required' => false },
|
271
|
+
{ 'in' => 'formData', 'name' => 'links', 'type' => 'array', 'items' => { 'type' => 'string' }, 'required' => false }
|
272
|
+
],
|
273
|
+
'responses' => { '200' => { 'description' => 'This updates Thing.', 'schema' => { '$ref' => '#/definitions/Something' } } },
|
274
|
+
'tags' => ['thing'],
|
275
|
+
'operationId' => 'putThingId'
|
276
|
+
},
|
277
|
+
'delete' => {
|
278
|
+
'description' => 'This deletes Thing.',
|
279
|
+
'produces' => ['application/json'],
|
280
|
+
'parameters' => [{ 'in' => 'path', 'name' => 'id', 'type' => 'integer', 'format' => 'int32', 'required' => true }],
|
281
|
+
'responses' => { '200' => { 'description' => 'This deletes Thing.', 'schema' => { '$ref' => '#/definitions/Something' } } },
|
282
|
+
'tags' => ['thing'],
|
283
|
+
'operationId' => 'deleteThingId'
|
284
|
+
}
|
285
|
+
},
|
286
|
+
'/thing2' => {
|
287
|
+
'get' => {
|
288
|
+
'description' => 'This gets Things.',
|
289
|
+
'produces' => ['application/json'],
|
290
|
+
'responses' => { '200' => { 'description' => 'get Horses', 'schema' => { '$ref' => '#/definitions/Something' } }, '401' => { 'description' => 'HorsesOutError', 'schema' => { '$ref' => '#/definitions/ApiError' } } },
|
291
|
+
'tags' => ['thing2'],
|
292
|
+
'operationId' => 'getThing2'
|
293
|
+
}
|
294
|
+
},
|
295
|
+
'/dummy/{id}' => {
|
296
|
+
'delete' => {
|
297
|
+
'description' => 'dummy route.',
|
298
|
+
'produces' => ['application/json'],
|
299
|
+
'parameters' => [{ 'in' => 'path', 'name' => 'id', 'type' => 'integer', 'format' => 'int32', 'required' => true }],
|
300
|
+
'responses' => { '204' => { 'description' => 'dummy route.' }, '401' => { 'description' => 'Unauthorized' } },
|
301
|
+
'tags' => ['dummy'],
|
302
|
+
'operationId' => 'deleteDummyId'
|
303
|
+
}
|
304
|
+
}
|
305
|
+
},
|
306
|
+
'definitions' => {
|
307
|
+
'QueryInput' => {
|
308
|
+
'type' => 'object',
|
309
|
+
'properties' => {
|
310
|
+
'mock_data' => {
|
311
|
+
'type' => 'string',
|
312
|
+
'description' => "it's a mock"
|
313
|
+
}
|
314
|
+
},
|
315
|
+
'description' => 'QueryInput model'
|
316
|
+
},
|
317
|
+
'ApiError' => {
|
318
|
+
'type' => 'object',
|
319
|
+
'properties' => {
|
320
|
+
'mock_data' => {
|
321
|
+
'type' => 'string',
|
322
|
+
'description' => "it's a mock"
|
323
|
+
}
|
324
|
+
},
|
325
|
+
'description' => 'ApiError model'
|
326
|
+
},
|
327
|
+
'Something' => {
|
328
|
+
'type' => 'object',
|
329
|
+
'properties' => {
|
330
|
+
'mock_data' => {
|
331
|
+
'type' => 'string',
|
332
|
+
'description' => "it's a mock"
|
333
|
+
}
|
334
|
+
},
|
335
|
+
'description' => 'Something model'
|
336
|
+
}
|
337
|
+
}
|
338
|
+
}
|
339
|
+
end
|
340
|
+
|
341
|
+
let(:http_verbs) { %w[get post put delete] }
|
342
|
+
end
|
343
|
+
|
344
|
+
def mounted_paths
|
345
|
+
%w[/thing /other_thing /dummy]
|
346
|
+
end
|