grape-swagger 0.11.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +8 -1
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +14 -22
- data/.travis.yml +7 -4
- data/CHANGELOG.md +53 -26
- data/Gemfile +1 -1
- data/README.md +414 -327
- data/RELEASING.md +3 -4
- data/example/api/endpoints.rb +132 -0
- data/example/api/entities.rb +18 -0
- data/example/config.ru +36 -2
- data/example/example_requests.postman_collection +146 -0
- data/example/swagger-example.png +0 -0
- data/grape-swagger.gemspec +9 -6
- data/lib/grape-swagger.rb +69 -99
- data/lib/grape-swagger/doc_methods.rb +69 -544
- data/lib/grape-swagger/doc_methods/data_type.rb +77 -0
- data/lib/grape-swagger/doc_methods/extensions.rb +75 -0
- data/lib/grape-swagger/doc_methods/move_params.rb +153 -0
- data/lib/grape-swagger/doc_methods/operation_id.rb +27 -0
- data/lib/grape-swagger/doc_methods/optional_object.rb +15 -0
- data/lib/grape-swagger/doc_methods/parse_params.rb +113 -0
- data/lib/grape-swagger/doc_methods/path_string.rb +29 -0
- data/lib/grape-swagger/doc_methods/produces_consumes.rb +12 -0
- data/lib/grape-swagger/doc_methods/status_codes.rb +17 -0
- data/lib/grape-swagger/doc_methods/tag_name_description.rb +26 -0
- data/lib/grape-swagger/endpoint.rb +317 -0
- data/lib/grape-swagger/version.rb +1 -1
- data/spec/lib/data_type_spec.rb +57 -0
- data/spec/lib/endpoint_spec.rb +6 -0
- data/spec/lib/extensions_spec.rb +127 -0
- data/spec/lib/move_params_spec.rb +298 -0
- data/spec/lib/operation_id_spec.rb +24 -0
- data/spec/lib/optional_object_spec.rb +40 -0
- data/spec/lib/path_string_spec.rb +38 -0
- data/spec/lib/produces_consumes_spec.rb +98 -0
- data/spec/markdown/kramdown_adapter_spec.rb +2 -9
- data/spec/markdown/redcarpet_adapter_spec.rb +2 -16
- data/spec/spec_helper.rb +7 -13
- data/spec/support/api_swagger_v2_result.rb +204 -0
- data/spec/support/namespace_tags.rb +73 -0
- data/spec/support/the_api_entities.rb +52 -0
- data/spec/support/the_paths_definitions.rb +94 -0
- data/spec/swagger_v2/api_swagger_v2_definitions-models_spec.rb +32 -0
- data/spec/swagger_v2/api_swagger_v2_detail_spec.rb +151 -0
- data/spec/swagger_v2/api_swagger_v2_extensions_spec.rb +109 -0
- data/spec/swagger_v2/api_swagger_v2_format-content_type_spec.rb +124 -0
- data/spec/swagger_v2/api_swagger_v2_global_configuration_spec.rb +51 -0
- data/spec/swagger_v2/api_swagger_v2_headers_spec.rb +44 -0
- data/spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb +56 -0
- data/spec/swagger_v2/api_swagger_v2_mounted_spec.rb +146 -0
- data/spec/swagger_v2/api_swagger_v2_param_type_body_nested_spec.rb +197 -0
- data/spec/swagger_v2/api_swagger_v2_param_type_body_spec.rb +151 -0
- data/spec/swagger_v2/api_swagger_v2_param_type_spec.rb +217 -0
- data/spec/swagger_v2/api_swagger_v2_request_params_fix_spec.rb +64 -0
- data/spec/swagger_v2/api_swagger_v2_response_spec.rb +184 -0
- data/spec/swagger_v2/api_swagger_v2_spec.rb +207 -0
- data/spec/swagger_v2/api_swagger_v2_type-format_spec.rb +121 -0
- data/spec/{boolean_params_spec.rb → swagger_v2/boolean_params_spec.rb} +2 -2
- data/spec/{default_api_spec.rb → swagger_v2/default_api_spec.rb} +40 -36
- data/spec/swagger_v2/description_not_initialized.rb +39 -0
- data/spec/{float_api_spec.rb → swagger_v2/float_api_spec.rb} +2 -2
- data/spec/{form_params_spec.rb → swagger_v2/form_params_spec.rb} +9 -9
- data/spec/{grape-swagger_spec.rb → swagger_v2/grape-swagger_spec.rb} +0 -0
- data/spec/swagger_v2/hide_api_spec.rb +131 -0
- data/spec/swagger_v2/mounted_target_class_spec.rb +76 -0
- data/spec/swagger_v2/namespace_tags_prefix_spec.rb +84 -0
- data/spec/swagger_v2/namespace_tags_spec.rb +76 -0
- data/spec/{namespaced_api_spec.rb → swagger_v2/namespaced_api_spec.rb} +6 -26
- data/spec/{param_type_spec.rb → swagger_v2/param_type_spec.rb} +10 -8
- data/spec/{param_values_spec.rb → swagger_v2/param_values_spec.rb} +52 -22
- data/spec/swagger_v2/params_array_spec.rb +63 -0
- data/spec/swagger_v2/params_hash_spec.rb +65 -0
- data/spec/swagger_v2/params_nested_spec.rb +63 -0
- data/spec/{reference_entity.rb → swagger_v2/reference_entity.rb} +18 -23
- data/spec/swagger_v2/response_model_spec.rb +212 -0
- data/spec/swagger_v2/simple_mounted_api_spec.rb +264 -0
- metadata +175 -90
- data/example/api.rb +0 -66
- data/lib/grape-swagger/markdown.rb +0 -23
- data/spec/api_description_spec.rb +0 -43
- data/spec/api_global_models_spec.rb +0 -77
- data/spec/api_models_spec.rb +0 -364
- data/spec/api_paths_spec.rb +0 -128
- data/spec/api_root_spec.rb +0 -30
- data/spec/api_with_nil_types.rb +0 -50
- data/spec/api_with_path_versioning_spec.rb +0 -33
- data/spec/api_with_prefix_and_namespace_spec.rb +0 -32
- data/spec/api_with_standalone_namespace_spec.rb +0 -215
- data/spec/array_entity_spec.rb +0 -34
- data/spec/array_params_spec.rb +0 -85
- data/spec/grape-swagger_helper_spec.rb +0 -152
- data/spec/group_params_spec.rb +0 -31
- data/spec/hash_params_spec.rb +0 -30
- data/spec/hide_api_spec.rb +0 -124
- data/spec/i18n_spec.rb +0 -364
- data/spec/markdown/markdown_spec.rb +0 -27
- data/spec/mounted_target_class_spec.rb +0 -63
- data/spec/mutually_exclusive_spec.rb +0 -36
- data/spec/non_default_api_spec.rb +0 -733
- data/spec/response_model_spec.rb +0 -121
- data/spec/simple_mounted_api_spec.rb +0 -213
- data/spec/support/i18n_helper.rb +0 -8
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-swagger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Vandecasteele
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape
|
@@ -16,28 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: grape-entity
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: awesome_print
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - "
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,58 +154,86 @@ dependencies:
|
|
140
154
|
name: rubocop
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
|
-
- -
|
157
|
+
- - ">="
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0
|
159
|
+
version: '0'
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
|
-
- -
|
164
|
+
- - ">="
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0
|
166
|
+
version: '0'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: kramdown
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
|
-
- - "
|
171
|
+
- - ">="
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
173
|
+
version: '0'
|
160
174
|
type: :development
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
|
-
- - "
|
178
|
+
- - ">="
|
165
179
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
180
|
+
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: redcarpet
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
170
184
|
requirements:
|
171
|
-
- - "
|
185
|
+
- - ">="
|
172
186
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
187
|
+
version: '0'
|
174
188
|
type: :development
|
175
189
|
prerelease: false
|
176
190
|
version_requirements: !ruby/object:Gem::Requirement
|
177
191
|
requirements:
|
178
|
-
- - "
|
192
|
+
- - ">="
|
179
193
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
194
|
+
version: '0'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: rouge
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
184
198
|
requirements:
|
185
|
-
- - "
|
199
|
+
- - ">="
|
186
200
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
201
|
+
version: '0'
|
188
202
|
type: :development
|
189
203
|
prerelease: false
|
190
204
|
version_requirements: !ruby/object:Gem::Requirement
|
191
205
|
requirements:
|
192
|
-
- - "
|
206
|
+
- - ">="
|
193
207
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
208
|
+
version: '0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: pry
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: pry-byebug
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
195
237
|
description:
|
196
238
|
email:
|
197
239
|
- tim.vandecasteele@gmail.com
|
@@ -214,53 +256,81 @@ files:
|
|
214
256
|
- RELEASING.md
|
215
257
|
- Rakefile
|
216
258
|
- UPGRADING.md
|
217
|
-
- example/api.rb
|
259
|
+
- example/api/endpoints.rb
|
260
|
+
- example/api/entities.rb
|
218
261
|
- example/config.ru
|
262
|
+
- example/example_requests.postman_collection
|
219
263
|
- example/splines.png
|
264
|
+
- example/swagger-example.png
|
220
265
|
- grape-swagger.gemspec
|
221
266
|
- lib/grape-swagger.rb
|
222
267
|
- lib/grape-swagger/doc_methods.rb
|
268
|
+
- lib/grape-swagger/doc_methods/data_type.rb
|
269
|
+
- lib/grape-swagger/doc_methods/extensions.rb
|
270
|
+
- lib/grape-swagger/doc_methods/move_params.rb
|
271
|
+
- lib/grape-swagger/doc_methods/operation_id.rb
|
272
|
+
- lib/grape-swagger/doc_methods/optional_object.rb
|
273
|
+
- lib/grape-swagger/doc_methods/parse_params.rb
|
274
|
+
- lib/grape-swagger/doc_methods/path_string.rb
|
275
|
+
- lib/grape-swagger/doc_methods/produces_consumes.rb
|
276
|
+
- lib/grape-swagger/doc_methods/status_codes.rb
|
277
|
+
- lib/grape-swagger/doc_methods/tag_name_description.rb
|
278
|
+
- lib/grape-swagger/endpoint.rb
|
223
279
|
- lib/grape-swagger/errors.rb
|
224
|
-
- lib/grape-swagger/markdown.rb
|
225
280
|
- lib/grape-swagger/markdown/kramdown_adapter.rb
|
226
281
|
- lib/grape-swagger/markdown/redcarpet_adapter.rb
|
227
282
|
- lib/grape-swagger/version.rb
|
228
|
-
- spec/
|
229
|
-
- spec/
|
230
|
-
- spec/
|
231
|
-
- spec/
|
232
|
-
- spec/
|
233
|
-
- spec/
|
234
|
-
- spec/
|
235
|
-
- spec/
|
236
|
-
- spec/api_with_standalone_namespace_spec.rb
|
237
|
-
- spec/array_entity_spec.rb
|
238
|
-
- spec/array_params_spec.rb
|
239
|
-
- spec/boolean_params_spec.rb
|
240
|
-
- spec/default_api_spec.rb
|
241
|
-
- spec/float_api_spec.rb
|
242
|
-
- spec/form_params_spec.rb
|
243
|
-
- spec/grape-swagger_helper_spec.rb
|
244
|
-
- spec/grape-swagger_spec.rb
|
245
|
-
- spec/group_params_spec.rb
|
246
|
-
- spec/hash_params_spec.rb
|
247
|
-
- spec/hide_api_spec.rb
|
248
|
-
- spec/i18n_spec.rb
|
283
|
+
- spec/lib/data_type_spec.rb
|
284
|
+
- spec/lib/endpoint_spec.rb
|
285
|
+
- spec/lib/extensions_spec.rb
|
286
|
+
- spec/lib/move_params_spec.rb
|
287
|
+
- spec/lib/operation_id_spec.rb
|
288
|
+
- spec/lib/optional_object_spec.rb
|
289
|
+
- spec/lib/path_string_spec.rb
|
290
|
+
- spec/lib/produces_consumes_spec.rb
|
249
291
|
- spec/markdown/kramdown_adapter_spec.rb
|
250
|
-
- spec/markdown/markdown_spec.rb
|
251
292
|
- spec/markdown/redcarpet_adapter_spec.rb
|
252
|
-
- spec/
|
253
|
-
- spec/mutually_exclusive_spec.rb
|
254
|
-
- spec/namespaced_api_spec.rb
|
255
|
-
- spec/non_default_api_spec.rb
|
256
|
-
- spec/param_type_spec.rb
|
257
|
-
- spec/param_values_spec.rb
|
258
|
-
- spec/reference_entity.rb
|
259
|
-
- spec/response_model_spec.rb
|
260
|
-
- spec/simple_mounted_api_spec.rb
|
293
|
+
- spec/params_entity_spec.rb
|
261
294
|
- spec/spec_helper.rb
|
295
|
+
- spec/support/api_swagger_v2_result.rb
|
262
296
|
- spec/support/grape_version.rb
|
263
|
-
- spec/support/
|
297
|
+
- spec/support/namespace_tags.rb
|
298
|
+
- spec/support/the_api_entities.rb
|
299
|
+
- spec/support/the_paths_definitions.rb
|
300
|
+
- spec/swagger_v2/api_swagger_v2_definitions-models_spec.rb
|
301
|
+
- spec/swagger_v2/api_swagger_v2_detail_spec.rb
|
302
|
+
- spec/swagger_v2/api_swagger_v2_extensions_spec.rb
|
303
|
+
- spec/swagger_v2/api_swagger_v2_format-content_type_spec.rb
|
304
|
+
- spec/swagger_v2/api_swagger_v2_global_configuration_spec.rb
|
305
|
+
- spec/swagger_v2/api_swagger_v2_headers_spec.rb
|
306
|
+
- spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
|
307
|
+
- spec/swagger_v2/api_swagger_v2_mounted_spec.rb
|
308
|
+
- spec/swagger_v2/api_swagger_v2_param_type_body_nested_spec.rb
|
309
|
+
- spec/swagger_v2/api_swagger_v2_param_type_body_spec.rb
|
310
|
+
- spec/swagger_v2/api_swagger_v2_param_type_spec.rb
|
311
|
+
- spec/swagger_v2/api_swagger_v2_request_params_fix_spec.rb
|
312
|
+
- spec/swagger_v2/api_swagger_v2_response_spec.rb
|
313
|
+
- spec/swagger_v2/api_swagger_v2_spec.rb
|
314
|
+
- spec/swagger_v2/api_swagger_v2_type-format_spec.rb
|
315
|
+
- spec/swagger_v2/boolean_params_spec.rb
|
316
|
+
- spec/swagger_v2/default_api_spec.rb
|
317
|
+
- spec/swagger_v2/description_not_initialized.rb
|
318
|
+
- spec/swagger_v2/float_api_spec.rb
|
319
|
+
- spec/swagger_v2/form_params_spec.rb
|
320
|
+
- spec/swagger_v2/grape-swagger_spec.rb
|
321
|
+
- spec/swagger_v2/hide_api_spec.rb
|
322
|
+
- spec/swagger_v2/mounted_target_class_spec.rb
|
323
|
+
- spec/swagger_v2/namespace_tags_prefix_spec.rb
|
324
|
+
- spec/swagger_v2/namespace_tags_spec.rb
|
325
|
+
- spec/swagger_v2/namespaced_api_spec.rb
|
326
|
+
- spec/swagger_v2/param_type_spec.rb
|
327
|
+
- spec/swagger_v2/param_values_spec.rb
|
328
|
+
- spec/swagger_v2/params_array_spec.rb
|
329
|
+
- spec/swagger_v2/params_hash_spec.rb
|
330
|
+
- spec/swagger_v2/params_nested_spec.rb
|
331
|
+
- spec/swagger_v2/reference_entity.rb
|
332
|
+
- spec/swagger_v2/response_model_spec.rb
|
333
|
+
- spec/swagger_v2/simple_mounted_api_spec.rb
|
264
334
|
- spec/version_spec.rb
|
265
335
|
homepage: https://github.com/ruby-grape/grape-swagger
|
266
336
|
licenses:
|
@@ -288,40 +358,55 @@ specification_version: 4
|
|
288
358
|
summary: A simple way to add auto generated documentation to your Grape API that can
|
289
359
|
be displayed with Swagger.
|
290
360
|
test_files:
|
291
|
-
- spec/
|
292
|
-
- spec/
|
293
|
-
- spec/
|
294
|
-
- spec/
|
295
|
-
- spec/
|
296
|
-
- spec/
|
297
|
-
- spec/
|
298
|
-
- spec/
|
299
|
-
- spec/api_with_standalone_namespace_spec.rb
|
300
|
-
- spec/array_entity_spec.rb
|
301
|
-
- spec/array_params_spec.rb
|
302
|
-
- spec/boolean_params_spec.rb
|
303
|
-
- spec/default_api_spec.rb
|
304
|
-
- spec/float_api_spec.rb
|
305
|
-
- spec/form_params_spec.rb
|
306
|
-
- spec/grape-swagger_helper_spec.rb
|
307
|
-
- spec/grape-swagger_spec.rb
|
308
|
-
- spec/group_params_spec.rb
|
309
|
-
- spec/hash_params_spec.rb
|
310
|
-
- spec/hide_api_spec.rb
|
311
|
-
- spec/i18n_spec.rb
|
361
|
+
- spec/lib/data_type_spec.rb
|
362
|
+
- spec/lib/endpoint_spec.rb
|
363
|
+
- spec/lib/extensions_spec.rb
|
364
|
+
- spec/lib/move_params_spec.rb
|
365
|
+
- spec/lib/operation_id_spec.rb
|
366
|
+
- spec/lib/optional_object_spec.rb
|
367
|
+
- spec/lib/path_string_spec.rb
|
368
|
+
- spec/lib/produces_consumes_spec.rb
|
312
369
|
- spec/markdown/kramdown_adapter_spec.rb
|
313
|
-
- spec/markdown/markdown_spec.rb
|
314
370
|
- spec/markdown/redcarpet_adapter_spec.rb
|
315
|
-
- spec/
|
316
|
-
- spec/mutually_exclusive_spec.rb
|
317
|
-
- spec/namespaced_api_spec.rb
|
318
|
-
- spec/non_default_api_spec.rb
|
319
|
-
- spec/param_type_spec.rb
|
320
|
-
- spec/param_values_spec.rb
|
321
|
-
- spec/reference_entity.rb
|
322
|
-
- spec/response_model_spec.rb
|
323
|
-
- spec/simple_mounted_api_spec.rb
|
371
|
+
- spec/params_entity_spec.rb
|
324
372
|
- spec/spec_helper.rb
|
373
|
+
- spec/support/api_swagger_v2_result.rb
|
325
374
|
- spec/support/grape_version.rb
|
326
|
-
- spec/support/
|
375
|
+
- spec/support/namespace_tags.rb
|
376
|
+
- spec/support/the_api_entities.rb
|
377
|
+
- spec/support/the_paths_definitions.rb
|
378
|
+
- spec/swagger_v2/api_swagger_v2_definitions-models_spec.rb
|
379
|
+
- spec/swagger_v2/api_swagger_v2_detail_spec.rb
|
380
|
+
- spec/swagger_v2/api_swagger_v2_extensions_spec.rb
|
381
|
+
- spec/swagger_v2/api_swagger_v2_format-content_type_spec.rb
|
382
|
+
- spec/swagger_v2/api_swagger_v2_global_configuration_spec.rb
|
383
|
+
- spec/swagger_v2/api_swagger_v2_headers_spec.rb
|
384
|
+
- spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
|
385
|
+
- spec/swagger_v2/api_swagger_v2_mounted_spec.rb
|
386
|
+
- spec/swagger_v2/api_swagger_v2_param_type_body_nested_spec.rb
|
387
|
+
- spec/swagger_v2/api_swagger_v2_param_type_body_spec.rb
|
388
|
+
- spec/swagger_v2/api_swagger_v2_param_type_spec.rb
|
389
|
+
- spec/swagger_v2/api_swagger_v2_request_params_fix_spec.rb
|
390
|
+
- spec/swagger_v2/api_swagger_v2_response_spec.rb
|
391
|
+
- spec/swagger_v2/api_swagger_v2_spec.rb
|
392
|
+
- spec/swagger_v2/api_swagger_v2_type-format_spec.rb
|
393
|
+
- spec/swagger_v2/boolean_params_spec.rb
|
394
|
+
- spec/swagger_v2/default_api_spec.rb
|
395
|
+
- spec/swagger_v2/description_not_initialized.rb
|
396
|
+
- spec/swagger_v2/float_api_spec.rb
|
397
|
+
- spec/swagger_v2/form_params_spec.rb
|
398
|
+
- spec/swagger_v2/grape-swagger_spec.rb
|
399
|
+
- spec/swagger_v2/hide_api_spec.rb
|
400
|
+
- spec/swagger_v2/mounted_target_class_spec.rb
|
401
|
+
- spec/swagger_v2/namespace_tags_prefix_spec.rb
|
402
|
+
- spec/swagger_v2/namespace_tags_spec.rb
|
403
|
+
- spec/swagger_v2/namespaced_api_spec.rb
|
404
|
+
- spec/swagger_v2/param_type_spec.rb
|
405
|
+
- spec/swagger_v2/param_values_spec.rb
|
406
|
+
- spec/swagger_v2/params_array_spec.rb
|
407
|
+
- spec/swagger_v2/params_hash_spec.rb
|
408
|
+
- spec/swagger_v2/params_nested_spec.rb
|
409
|
+
- spec/swagger_v2/reference_entity.rb
|
410
|
+
- spec/swagger_v2/response_model_spec.rb
|
411
|
+
- spec/swagger_v2/simple_mounted_api_spec.rb
|
327
412
|
- spec/version_spec.rb
|
data/example/api.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'grape'
|
2
|
-
require '../lib/grape-swagger'
|
3
|
-
|
4
|
-
@@splines = {}
|
5
|
-
|
6
|
-
class Api < Grape::API
|
7
|
-
format :json
|
8
|
-
|
9
|
-
desc 'API Root'
|
10
|
-
get do
|
11
|
-
{ splines_url: '/splines' }
|
12
|
-
end
|
13
|
-
|
14
|
-
namespace :splines do
|
15
|
-
desc 'Return a spline.'
|
16
|
-
params do
|
17
|
-
requires :id, type: Integer, desc: 'Spline id.'
|
18
|
-
end
|
19
|
-
get ':id' do
|
20
|
-
@@splines[params[:id]] || error!('Not Found', 404)
|
21
|
-
end
|
22
|
-
|
23
|
-
desc 'Update a spline.'
|
24
|
-
params do
|
25
|
-
requires :id, type: Integer, desc: 'Spline id.'
|
26
|
-
optional :reticulated, type: Boolean, default: true, desc: 'True if the spline is reticulated.'
|
27
|
-
end
|
28
|
-
put ':id' do
|
29
|
-
spline = (@@splines[params[:id]] || error!('Not Found', 404))
|
30
|
-
spline[:reticulated] = params[:reticulated]
|
31
|
-
spline
|
32
|
-
end
|
33
|
-
|
34
|
-
desc 'Create a spline.'
|
35
|
-
params do
|
36
|
-
optional :reticulated, type: Boolean, default: true, desc: 'True if the spline is reticulated.'
|
37
|
-
requires :required_group, type: Hash do
|
38
|
-
requires :required_param_1
|
39
|
-
requires :required_param_2
|
40
|
-
end
|
41
|
-
end
|
42
|
-
post do
|
43
|
-
spline = { id: @@splines.size + 1, reticulated: params[:reticulated] }
|
44
|
-
@@splines[@@splines.size + 1] = spline
|
45
|
-
spline
|
46
|
-
end
|
47
|
-
|
48
|
-
desc 'Return all splines.'
|
49
|
-
get do
|
50
|
-
@@splines.values
|
51
|
-
end
|
52
|
-
|
53
|
-
# TEST api for testing uploading
|
54
|
-
# curl --form file=@splines.png http://localhost:9292/splines/upload
|
55
|
-
desc 'Update image'
|
56
|
-
post 'upload' do
|
57
|
-
filename = params[:file][:filename]
|
58
|
-
content_type 'application/octet-stream'
|
59
|
-
env['api.format'] = :binary # there's no formatter for :binary, data will be returned "as is"
|
60
|
-
header 'Content-Disposition', "attachment; filename*=UTF-8''#{URI.escape(filename)}"
|
61
|
-
params[:file][:tempfile].read
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
add_swagger_documentation
|
66
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module GrapeSwagger
|
2
|
-
class Markdown
|
3
|
-
attr_reader :adapter
|
4
|
-
|
5
|
-
###
|
6
|
-
# Initializes the markdown class with an adapter.
|
7
|
-
# The adapter needs to implement the method markdown which will be called by this interface class.
|
8
|
-
# The adapters are responsible of loading the required markdown dependencies and throw errors.
|
9
|
-
###
|
10
|
-
def initialize(adapter)
|
11
|
-
adapter = adapter.new if adapter.is_a?(Class)
|
12
|
-
fail(ArgumentError, 'The configured markdown adapter should implement the method markdown') unless adapter.respond_to? :markdown
|
13
|
-
@adapter = adapter
|
14
|
-
end
|
15
|
-
|
16
|
-
###
|
17
|
-
# Calls markdown to the configured adapter.
|
18
|
-
###
|
19
|
-
def as_markdown(text)
|
20
|
-
@adapter.markdown(text)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|