grape 1.6.2 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +54 -1
  3. data/CONTRIBUTING.md +30 -0
  4. data/README.md +146 -23
  5. data/UPGRADING.md +15 -0
  6. data/grape.gemspec +2 -2
  7. data/lib/grape/api/instance.rb +1 -1
  8. data/lib/grape/dry_types.rb +12 -0
  9. data/lib/grape/dsl/api.rb +0 -2
  10. data/lib/grape/dsl/callbacks.rb +0 -2
  11. data/lib/grape/dsl/configuration.rb +0 -2
  12. data/lib/grape/dsl/desc.rb +2 -16
  13. data/lib/grape/dsl/helpers.rb +0 -2
  14. data/lib/grape/dsl/inside_route.rb +34 -30
  15. data/lib/grape/dsl/middleware.rb +0 -2
  16. data/lib/grape/dsl/parameters.rb +10 -7
  17. data/lib/grape/dsl/request_response.rb +1 -3
  18. data/lib/grape/dsl/routing.rb +4 -2
  19. data/lib/grape/dsl/settings.rb +0 -2
  20. data/lib/grape/dsl/validations.rb +0 -15
  21. data/lib/grape/endpoint.rb +2 -2
  22. data/lib/grape/error_formatter/json.rb +7 -1
  23. data/lib/grape/exceptions/base.rb +3 -2
  24. data/lib/grape/exceptions/missing_group_type.rb +8 -1
  25. data/lib/grape/exceptions/too_many_multipart_files.rb +11 -0
  26. data/lib/grape/exceptions/unsupported_group_type.rb +8 -1
  27. data/lib/grape/exceptions/validation.rb +0 -4
  28. data/lib/grape/locale/en.yml +9 -8
  29. data/lib/grape/middleware/auth/dsl.rb +0 -1
  30. data/lib/grape/middleware/error.rb +2 -2
  31. data/lib/grape/middleware/stack.rb +1 -1
  32. data/lib/grape/request.rb +3 -1
  33. data/lib/grape/router/attribute_translator.rb +1 -1
  34. data/lib/grape/types/invalid_value.rb +8 -0
  35. data/lib/grape/util/cache.rb +1 -1
  36. data/lib/grape/util/json.rb +2 -0
  37. data/lib/grape/validations/attributes_doc.rb +58 -0
  38. data/lib/grape/validations/params_scope.rb +67 -41
  39. data/lib/grape/validations/types/array_coercer.rb +0 -2
  40. data/lib/grape/validations/types/dry_type_coercer.rb +3 -7
  41. data/lib/grape/validations/types/invalid_value.rb +0 -7
  42. data/lib/grape/validations/types/primitive_coercer.rb +14 -6
  43. data/lib/grape/validations/types/set_coercer.rb +0 -2
  44. data/lib/grape/validations/types.rb +98 -30
  45. data/lib/grape/validations/validators/{all_or_none.rb → all_or_none_of_validator.rb} +0 -2
  46. data/lib/grape/validations/validators/{at_least_one_of.rb → at_least_one_of_validator.rb} +0 -2
  47. data/lib/grape/validations/validators/base.rb +7 -0
  48. data/lib/grape/validations/validators/{exactly_one_of.rb → exactly_one_of_validator.rb} +0 -2
  49. data/lib/grape/validations/validators/{mutual_exclusion.rb → mutual_exclusion_validator.rb} +0 -2
  50. data/lib/grape/validations.rb +16 -12
  51. data/lib/grape/version.rb +1 -1
  52. data/lib/grape.rb +74 -28
  53. data/spec/grape/api/custom_validations_spec.rb +41 -2
  54. data/spec/grape/api/deeply_included_options_spec.rb +0 -2
  55. data/spec/grape/api/defines_boolean_in_params_spec.rb +0 -2
  56. data/spec/grape/api/documentation_spec.rb +59 -0
  57. data/spec/grape/api/inherited_helpers_spec.rb +0 -2
  58. data/spec/grape/api/instance_spec.rb +0 -1
  59. data/spec/grape/api/invalid_format_spec.rb +0 -2
  60. data/spec/grape/api/namespace_parameters_in_route_spec.rb +0 -2
  61. data/spec/grape/api/nested_helpers_spec.rb +0 -2
  62. data/spec/grape/api/optional_parameters_in_route_spec.rb +0 -2
  63. data/spec/grape/api/parameters_modification_spec.rb +0 -2
  64. data/spec/grape/api/patch_method_helpers_spec.rb +0 -2
  65. data/spec/grape/api/recognize_path_spec.rb +0 -2
  66. data/spec/grape/api/required_parameters_in_route_spec.rb +0 -2
  67. data/spec/grape/api/required_parameters_with_invalid_method_spec.rb +0 -2
  68. data/spec/grape/api/routes_with_requirements_spec.rb +0 -2
  69. data/spec/grape/api/shared_helpers_exactly_one_of_spec.rb +0 -2
  70. data/spec/grape/api/shared_helpers_spec.rb +0 -2
  71. data/spec/grape/api_remount_spec.rb +0 -1
  72. data/spec/grape/api_spec.rb +23 -25
  73. data/spec/grape/config_spec.rb +0 -2
  74. data/spec/grape/dsl/callbacks_spec.rb +0 -2
  75. data/spec/grape/dsl/desc_spec.rb +2 -2
  76. data/spec/grape/dsl/headers_spec.rb +2 -4
  77. data/spec/grape/dsl/helpers_spec.rb +0 -2
  78. data/spec/grape/dsl/inside_route_spec.rb +10 -12
  79. data/spec/grape/dsl/logger_spec.rb +0 -2
  80. data/spec/grape/dsl/middleware_spec.rb +0 -2
  81. data/spec/grape/dsl/parameters_spec.rb +0 -2
  82. data/spec/grape/dsl/request_response_spec.rb +6 -8
  83. data/spec/grape/dsl/routing_spec.rb +1 -3
  84. data/spec/grape/dsl/settings_spec.rb +0 -2
  85. data/spec/grape/dsl/validations_spec.rb +0 -17
  86. data/spec/grape/endpoint/declared_spec.rb +2 -4
  87. data/spec/grape/endpoint_spec.rb +29 -9
  88. data/spec/grape/entity_spec.rb +0 -1
  89. data/spec/grape/exceptions/base_spec.rb +16 -2
  90. data/spec/grape/exceptions/body_parse_errors_spec.rb +0 -2
  91. data/spec/grape/exceptions/invalid_accept_header_spec.rb +3 -2
  92. data/spec/grape/exceptions/invalid_formatter_spec.rb +0 -2
  93. data/spec/grape/exceptions/invalid_response_spec.rb +0 -2
  94. data/spec/grape/exceptions/invalid_versioner_option_spec.rb +1 -3
  95. data/spec/grape/exceptions/missing_group_type_spec.rb +21 -0
  96. data/spec/grape/exceptions/missing_mime_type_spec.rb +0 -2
  97. data/spec/grape/exceptions/missing_option_spec.rb +1 -3
  98. data/spec/grape/exceptions/unknown_options_spec.rb +0 -2
  99. data/spec/grape/exceptions/unknown_validator_spec.rb +0 -2
  100. data/spec/grape/exceptions/unsupported_group_type_spec.rb +23 -0
  101. data/spec/grape/exceptions/validation_errors_spec.rb +0 -1
  102. data/spec/grape/exceptions/validation_spec.rb +1 -3
  103. data/spec/grape/extensions/param_builders/hash_spec.rb +0 -2
  104. data/spec/grape/extensions/param_builders/hash_with_indifferent_access_spec.rb +0 -2
  105. data/spec/grape/extensions/param_builders/hashie/mash_spec.rb +0 -2
  106. data/spec/grape/integration/global_namespace_function_spec.rb +0 -2
  107. data/spec/grape/integration/rack_sendfile_spec.rb +0 -2
  108. data/spec/grape/integration/rack_spec.rb +6 -7
  109. data/spec/grape/loading_spec.rb +0 -2
  110. data/spec/grape/middleware/auth/base_spec.rb +0 -1
  111. data/spec/grape/middleware/auth/dsl_spec.rb +0 -2
  112. data/spec/grape/middleware/auth/strategies_spec.rb +0 -2
  113. data/spec/grape/middleware/base_spec.rb +7 -7
  114. data/spec/grape/middleware/error_spec.rb +6 -1
  115. data/spec/grape/middleware/exception_spec.rb +0 -2
  116. data/spec/grape/middleware/formatter_spec.rb +6 -8
  117. data/spec/grape/middleware/globals_spec.rb +0 -2
  118. data/spec/grape/middleware/stack_spec.rb +0 -2
  119. data/spec/grape/middleware/versioner/accept_version_header_spec.rb +0 -2
  120. data/spec/grape/middleware/versioner/header_spec.rb +18 -4
  121. data/spec/grape/middleware/versioner/param_spec.rb +0 -2
  122. data/spec/grape/middleware/versioner/path_spec.rb +0 -2
  123. data/spec/grape/middleware/versioner_spec.rb +0 -2
  124. data/spec/grape/named_api_spec.rb +0 -2
  125. data/spec/grape/parser_spec.rb +0 -2
  126. data/spec/grape/path_spec.rb +0 -2
  127. data/spec/grape/presenters/presenter_spec.rb +0 -2
  128. data/spec/grape/request_spec.rb +0 -2
  129. data/spec/grape/util/inheritable_setting_spec.rb +0 -1
  130. data/spec/grape/util/inheritable_values_spec.rb +0 -1
  131. data/spec/grape/util/reverse_stackable_values_spec.rb +0 -1
  132. data/spec/grape/util/stackable_values_spec.rb +0 -1
  133. data/spec/grape/util/strict_hash_configuration_spec.rb +0 -1
  134. data/spec/grape/validations/attributes_doc_spec.rb +153 -0
  135. data/spec/grape/validations/instance_behaivour_spec.rb +0 -2
  136. data/spec/grape/validations/multiple_attributes_iterator_spec.rb +0 -2
  137. data/spec/grape/validations/params_scope_spec.rb +315 -86
  138. data/spec/grape/validations/single_attribute_iterator_spec.rb +0 -2
  139. data/spec/grape/validations/types/array_coercer_spec.rb +0 -2
  140. data/spec/grape/validations/types/primitive_coercer_spec.rb +20 -5
  141. data/spec/grape/validations/types/set_coercer_spec.rb +0 -2
  142. data/spec/grape/validations/types_spec.rb +28 -2
  143. data/spec/grape/validations/validators/all_or_none_spec.rb +0 -2
  144. data/spec/grape/validations/validators/allow_blank_spec.rb +0 -2
  145. data/spec/grape/validations/validators/at_least_one_of_spec.rb +0 -2
  146. data/spec/grape/validations/validators/coerce_spec.rb +0 -2
  147. data/spec/grape/validations/validators/default_spec.rb +0 -2
  148. data/spec/grape/validations/validators/exactly_one_of_spec.rb +0 -2
  149. data/spec/grape/validations/validators/except_values_spec.rb +0 -2
  150. data/spec/grape/validations/validators/mutual_exclusion_spec.rb +0 -2
  151. data/spec/grape/validations/validators/presence_spec.rb +0 -2
  152. data/spec/grape/validations/validators/regexp_spec.rb +0 -2
  153. data/spec/grape/validations/validators/same_as_spec.rb +0 -2
  154. data/spec/grape/validations/validators/values_spec.rb +19 -2
  155. data/spec/grape/validations_spec.rb +78 -27
  156. data/spec/integration/multi_json/json_spec.rb +0 -2
  157. data/spec/integration/multi_xml/xml_spec.rb +0 -2
  158. data/spec/spec_helper.rb +9 -4
  159. metadata +134 -122
  160. data/spec/grape/dsl/configuration_spec.rb +0 -16
  161. data/spec/grape/validations/attributes_iterator_spec.rb +0 -6
  162. data/spec/support/eager_load.rb +0 -19
  163. /data/lib/grape/validations/validators/{allow_blank.rb → allow_blank_validator.rb} +0 -0
  164. /data/lib/grape/validations/validators/{as.rb → as_validator.rb} +0 -0
  165. /data/lib/grape/validations/validators/{coerce.rb → coerce_validator.rb} +0 -0
  166. /data/lib/grape/validations/validators/{default.rb → default_validator.rb} +0 -0
  167. /data/lib/grape/validations/validators/{except_values.rb → except_values_validator.rb} +0 -0
  168. /data/lib/grape/validations/validators/{presence.rb → presence_validator.rb} +0 -0
  169. /data/lib/grape/validations/validators/{regexp.rb → regexp_validator.rb} +0 -0
  170. /data/lib/grape/validations/validators/{same_as.rb → same_as_validator.rb} +0 -0
  171. /data/lib/grape/validations/validators/{values.rb → values_validator.rb} +0 -0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-30 00:00:00.000000000 Z
11
+ date: 2023-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -73,6 +73,9 @@ dependencies:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: 1.3.0
76
+ - - "<"
77
+ - !ruby/object:Gem::Version
78
+ version: '3'
76
79
  type: :runtime
77
80
  prerelease: false
78
81
  version_requirements: !ruby/object:Gem::Requirement
@@ -80,6 +83,9 @@ dependencies:
80
83
  - - ">="
81
84
  - !ruby/object:Gem::Version
82
85
  version: 1.3.0
86
+ - - "<"
87
+ - !ruby/object:Gem::Version
88
+ version: '3'
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: rack-accept
85
91
  requirement: !ruby/object:Gem::Requirement
@@ -115,6 +121,7 @@ files:
115
121
  - lib/grape/config.rb
116
122
  - lib/grape/content_types.rb
117
123
  - lib/grape/cookies.rb
124
+ - lib/grape/dry_types.rb
118
125
  - lib/grape/dsl/api.rb
119
126
  - lib/grape/dsl/callbacks.rb
120
127
  - lib/grape/dsl/configuration.rb
@@ -151,6 +158,7 @@ files:
151
158
  - lib/grape/exceptions/missing_mime_type.rb
152
159
  - lib/grape/exceptions/missing_option.rb
153
160
  - lib/grape/exceptions/missing_vendor_option.rb
161
+ - lib/grape/exceptions/too_many_multipart_files.rb
154
162
  - lib/grape/exceptions/unknown_options.rb
155
163
  - lib/grape/exceptions/unknown_parameter.rb
156
164
  - lib/grape/exceptions/unknown_validator.rb
@@ -201,6 +209,7 @@ files:
201
209
  - lib/grape/serve_stream/file_body.rb
202
210
  - lib/grape/serve_stream/sendfile_response.rb
203
211
  - lib/grape/serve_stream/stream_response.rb
212
+ - lib/grape/types/invalid_value.rb
204
213
  - lib/grape/util/base_inheritable.rb
205
214
  - lib/grape/util/cache.rb
206
215
  - lib/grape/util/endpoint_configuration.rb
@@ -217,6 +226,7 @@ files:
217
226
  - lib/grape/util/strict_hash_configuration.rb
218
227
  - lib/grape/util/xml.rb
219
228
  - lib/grape/validations.rb
229
+ - lib/grape/validations/attributes_doc.rb
220
230
  - lib/grape/validations/attributes_iterator.rb
221
231
  - lib/grape/validations/multiple_attributes_iterator.rb
222
232
  - lib/grape/validations/params_scope.rb
@@ -235,25 +245,26 @@ files:
235
245
  - lib/grape/validations/types/set_coercer.rb
236
246
  - lib/grape/validations/types/variant_collection_coercer.rb
237
247
  - lib/grape/validations/validator_factory.rb
238
- - lib/grape/validations/validators/all_or_none.rb
239
- - lib/grape/validations/validators/allow_blank.rb
240
- - lib/grape/validations/validators/as.rb
241
- - lib/grape/validations/validators/at_least_one_of.rb
248
+ - lib/grape/validations/validators/all_or_none_of_validator.rb
249
+ - lib/grape/validations/validators/allow_blank_validator.rb
250
+ - lib/grape/validations/validators/as_validator.rb
251
+ - lib/grape/validations/validators/at_least_one_of_validator.rb
242
252
  - lib/grape/validations/validators/base.rb
243
- - lib/grape/validations/validators/coerce.rb
244
- - lib/grape/validations/validators/default.rb
245
- - lib/grape/validations/validators/exactly_one_of.rb
246
- - lib/grape/validations/validators/except_values.rb
253
+ - lib/grape/validations/validators/coerce_validator.rb
254
+ - lib/grape/validations/validators/default_validator.rb
255
+ - lib/grape/validations/validators/exactly_one_of_validator.rb
256
+ - lib/grape/validations/validators/except_values_validator.rb
247
257
  - lib/grape/validations/validators/multiple_params_base.rb
248
- - lib/grape/validations/validators/mutual_exclusion.rb
249
- - lib/grape/validations/validators/presence.rb
250
- - lib/grape/validations/validators/regexp.rb
251
- - lib/grape/validations/validators/same_as.rb
252
- - lib/grape/validations/validators/values.rb
258
+ - lib/grape/validations/validators/mutual_exclusion_validator.rb
259
+ - lib/grape/validations/validators/presence_validator.rb
260
+ - lib/grape/validations/validators/regexp_validator.rb
261
+ - lib/grape/validations/validators/same_as_validator.rb
262
+ - lib/grape/validations/validators/values_validator.rb
253
263
  - lib/grape/version.rb
254
264
  - spec/grape/api/custom_validations_spec.rb
255
265
  - spec/grape/api/deeply_included_options_spec.rb
256
266
  - spec/grape/api/defines_boolean_in_params_spec.rb
267
+ - spec/grape/api/documentation_spec.rb
257
268
  - spec/grape/api/inherited_helpers_spec.rb
258
269
  - spec/grape/api/instance_spec.rb
259
270
  - spec/grape/api/invalid_format_spec.rb
@@ -272,7 +283,6 @@ files:
272
283
  - spec/grape/api_spec.rb
273
284
  - spec/grape/config_spec.rb
274
285
  - spec/grape/dsl/callbacks_spec.rb
275
- - spec/grape/dsl/configuration_spec.rb
276
286
  - spec/grape/dsl/desc_spec.rb
277
287
  - spec/grape/dsl/headers_spec.rb
278
288
  - spec/grape/dsl/helpers_spec.rb
@@ -293,10 +303,12 @@ files:
293
303
  - spec/grape/exceptions/invalid_formatter_spec.rb
294
304
  - spec/grape/exceptions/invalid_response_spec.rb
295
305
  - spec/grape/exceptions/invalid_versioner_option_spec.rb
306
+ - spec/grape/exceptions/missing_group_type_spec.rb
296
307
  - spec/grape/exceptions/missing_mime_type_spec.rb
297
308
  - spec/grape/exceptions/missing_option_spec.rb
298
309
  - spec/grape/exceptions/unknown_options_spec.rb
299
310
  - spec/grape/exceptions/unknown_validator_spec.rb
311
+ - spec/grape/exceptions/unsupported_group_type_spec.rb
300
312
  - spec/grape/exceptions/validation_errors_spec.rb
301
313
  - spec/grape/exceptions/validation_spec.rb
302
314
  - spec/grape/extensions/param_builders/hash_spec.rb
@@ -330,7 +342,7 @@ files:
330
342
  - spec/grape/util/reverse_stackable_values_spec.rb
331
343
  - spec/grape/util/stackable_values_spec.rb
332
344
  - spec/grape/util/strict_hash_configuration_spec.rb
333
- - spec/grape/validations/attributes_iterator_spec.rb
345
+ - spec/grape/validations/attributes_doc_spec.rb
334
346
  - spec/grape/validations/instance_behaivour_spec.rb
335
347
  - spec/grape/validations/multiple_attributes_iterator_spec.rb
336
348
  - spec/grape/validations/params_scope_spec.rb
@@ -361,7 +373,6 @@ files:
361
373
  - spec/support/basic_auth_encode_helpers.rb
362
374
  - spec/support/chunks.rb
363
375
  - spec/support/content_type_helpers.rb
364
- - spec/support/eager_load.rb
365
376
  - spec/support/endpoint_faker.rb
366
377
  - spec/support/file_streamer.rb
367
378
  - spec/support/integer_helpers.rb
@@ -371,10 +382,10 @@ licenses:
371
382
  - MIT
372
383
  metadata:
373
384
  bug_tracker_uri: https://github.com/ruby-grape/grape/issues
374
- changelog_uri: https://github.com/ruby-grape/grape/blob/v1.6.2/CHANGELOG.md
375
- documentation_uri: https://www.rubydoc.info/gems/grape/1.6.2
376
- source_code_uri: https://github.com/ruby-grape/grape/tree/v1.6.2
377
- post_install_message:
385
+ changelog_uri: https://github.com/ruby-grape/grape/blob/v1.7.1/CHANGELOG.md
386
+ documentation_uri: https://www.rubydoc.info/gems/grape/1.7.1
387
+ source_code_uri: https://github.com/ruby-grape/grape/tree/v1.7.1
388
+ post_install_message:
378
389
  rdoc_options: []
379
390
  require_paths:
380
391
  - lib
@@ -382,130 +393,131 @@ required_ruby_version: !ruby/object:Gem::Requirement
382
393
  requirements:
383
394
  - - ">="
384
395
  - !ruby/object:Gem::Version
385
- version: 2.5.0
396
+ version: 2.6.0
386
397
  required_rubygems_version: !ruby/object:Gem::Requirement
387
398
  requirements:
388
399
  - - ">="
389
400
  - !ruby/object:Gem::Version
390
401
  version: '0'
391
402
  requirements: []
392
- rubygems_version: 3.3.0.dev
393
- signing_key:
403
+ rubygems_version: 3.0.3
404
+ signing_key:
394
405
  specification_version: 4
395
406
  summary: A simple Ruby framework for building REST-like APIs.
396
407
  test_files:
397
- - spec/grape/api/custom_validations_spec.rb
398
- - spec/grape/api/deeply_included_options_spec.rb
399
- - spec/grape/api/defines_boolean_in_params_spec.rb
400
- - spec/grape/api/inherited_helpers_spec.rb
401
- - spec/grape/api/instance_spec.rb
402
- - spec/grape/api/invalid_format_spec.rb
403
- - spec/grape/api/namespace_parameters_in_route_spec.rb
404
- - spec/grape/api/nested_helpers_spec.rb
405
- - spec/grape/api/optional_parameters_in_route_spec.rb
406
- - spec/grape/api/parameters_modification_spec.rb
407
- - spec/grape/api/patch_method_helpers_spec.rb
408
- - spec/grape/api/recognize_path_spec.rb
409
- - spec/grape/api/required_parameters_in_route_spec.rb
410
- - spec/grape/api/required_parameters_with_invalid_method_spec.rb
411
- - spec/grape/api/routes_with_requirements_spec.rb
412
- - spec/grape/api/shared_helpers_exactly_one_of_spec.rb
413
- - spec/grape/api/shared_helpers_spec.rb
414
- - spec/grape/api_remount_spec.rb
415
- - spec/grape/api_spec.rb
416
- - spec/grape/config_spec.rb
417
- - spec/grape/dsl/callbacks_spec.rb
418
- - spec/grape/dsl/configuration_spec.rb
419
- - spec/grape/dsl/desc_spec.rb
420
- - spec/grape/dsl/headers_spec.rb
421
- - spec/grape/dsl/helpers_spec.rb
422
- - spec/grape/dsl/inside_route_spec.rb
423
- - spec/grape/dsl/logger_spec.rb
424
- - spec/grape/dsl/middleware_spec.rb
425
- - spec/grape/dsl/parameters_spec.rb
426
- - spec/grape/dsl/request_response_spec.rb
427
- - spec/grape/dsl/routing_spec.rb
428
- - spec/grape/dsl/settings_spec.rb
429
- - spec/grape/dsl/validations_spec.rb
430
- - spec/grape/endpoint/declared_spec.rb
431
- - spec/grape/endpoint_spec.rb
432
- - spec/grape/entity_spec.rb
433
- - spec/grape/exceptions/base_spec.rb
434
- - spec/grape/exceptions/body_parse_errors_spec.rb
435
- - spec/grape/exceptions/invalid_accept_header_spec.rb
436
- - spec/grape/exceptions/invalid_formatter_spec.rb
437
- - spec/grape/exceptions/invalid_response_spec.rb
438
- - spec/grape/exceptions/invalid_versioner_option_spec.rb
439
- - spec/grape/exceptions/missing_mime_type_spec.rb
440
- - spec/grape/exceptions/missing_option_spec.rb
441
- - spec/grape/exceptions/unknown_options_spec.rb
442
- - spec/grape/exceptions/unknown_validator_spec.rb
443
- - spec/grape/exceptions/validation_errors_spec.rb
444
- - spec/grape/exceptions/validation_spec.rb
445
- - spec/grape/extensions/param_builders/hash_spec.rb
446
- - spec/grape/extensions/param_builders/hash_with_indifferent_access_spec.rb
447
- - spec/grape/extensions/param_builders/hashie/mash_spec.rb
448
- - spec/grape/integration/global_namespace_function_spec.rb
449
- - spec/grape/integration/rack_sendfile_spec.rb
450
- - spec/grape/integration/rack_spec.rb
451
- - spec/grape/loading_spec.rb
452
- - spec/grape/middleware/auth/base_spec.rb
453
- - spec/grape/middleware/auth/dsl_spec.rb
454
- - spec/grape/middleware/auth/strategies_spec.rb
455
- - spec/grape/middleware/base_spec.rb
408
+ - spec/spec_helper.rb
409
+ - spec/integration/eager_load/eager_load_spec.rb
410
+ - spec/integration/multi_xml/xml_spec.rb
411
+ - spec/integration/multi_json/json_spec.rb
412
+ - spec/shared/versioning_examples.rb
413
+ - spec/support/basic_auth_encode_helpers.rb
414
+ - spec/support/endpoint_faker.rb
415
+ - spec/support/chunks.rb
416
+ - spec/support/file_streamer.rb
417
+ - spec/support/versioned_helpers.rb
418
+ - spec/support/content_type_helpers.rb
419
+ - spec/support/integer_helpers.rb
456
420
  - spec/grape/middleware/error_spec.rb
457
- - spec/grape/middleware/exception_spec.rb
458
- - spec/grape/middleware/formatter_spec.rb
459
421
  - spec/grape/middleware/globals_spec.rb
422
+ - spec/grape/middleware/formatter_spec.rb
423
+ - spec/grape/middleware/auth/strategies_spec.rb
424
+ - spec/grape/middleware/auth/dsl_spec.rb
425
+ - spec/grape/middleware/auth/base_spec.rb
460
426
  - spec/grape/middleware/stack_spec.rb
427
+ - spec/grape/middleware/exception_spec.rb
428
+ - spec/grape/middleware/versioner_spec.rb
461
429
  - spec/grape/middleware/versioner/accept_version_header_spec.rb
462
430
  - spec/grape/middleware/versioner/header_spec.rb
463
- - spec/grape/middleware/versioner/param_spec.rb
464
431
  - spec/grape/middleware/versioner/path_spec.rb
465
- - spec/grape/middleware/versioner_spec.rb
466
- - spec/grape/named_api_spec.rb
467
- - spec/grape/parser_spec.rb
468
- - spec/grape/path_spec.rb
469
- - spec/grape/presenters/presenter_spec.rb
470
- - spec/grape/request_spec.rb
471
- - spec/grape/util/inheritable_setting_spec.rb
472
- - spec/grape/util/inheritable_values_spec.rb
432
+ - spec/grape/middleware/versioner/param_spec.rb
433
+ - spec/grape/middleware/base_spec.rb
434
+ - spec/grape/config_spec.rb
435
+ - spec/grape/loading_spec.rb
436
+ - spec/grape/endpoint_spec.rb
437
+ - spec/grape/api_spec.rb
473
438
  - spec/grape/util/reverse_stackable_values_spec.rb
474
439
  - spec/grape/util/stackable_values_spec.rb
440
+ - spec/grape/util/inheritable_setting_spec.rb
475
441
  - spec/grape/util/strict_hash_configuration_spec.rb
476
- - spec/grape/validations/attributes_iterator_spec.rb
477
- - spec/grape/validations/instance_behaivour_spec.rb
478
- - spec/grape/validations/multiple_attributes_iterator_spec.rb
479
- - spec/grape/validations/params_scope_spec.rb
442
+ - spec/grape/util/inheritable_values_spec.rb
443
+ - spec/grape/integration/rack_spec.rb
444
+ - spec/grape/integration/rack_sendfile_spec.rb
445
+ - spec/grape/integration/global_namespace_function_spec.rb
446
+ - spec/grape/validations_spec.rb
447
+ - spec/grape/entity_spec.rb
448
+ - spec/grape/exceptions/missing_group_type_spec.rb
449
+ - spec/grape/exceptions/unsupported_group_type_spec.rb
450
+ - spec/grape/exceptions/validation_spec.rb
451
+ - spec/grape/exceptions/invalid_accept_header_spec.rb
452
+ - spec/grape/exceptions/missing_option_spec.rb
453
+ - spec/grape/exceptions/invalid_response_spec.rb
454
+ - spec/grape/exceptions/body_parse_errors_spec.rb
455
+ - spec/grape/exceptions/invalid_formatter_spec.rb
456
+ - spec/grape/exceptions/missing_mime_type_spec.rb
457
+ - spec/grape/exceptions/unknown_options_spec.rb
458
+ - spec/grape/exceptions/validation_errors_spec.rb
459
+ - spec/grape/exceptions/unknown_validator_spec.rb
460
+ - spec/grape/exceptions/invalid_versioner_option_spec.rb
461
+ - spec/grape/exceptions/base_spec.rb
462
+ - spec/grape/presenters/presenter_spec.rb
480
463
  - spec/grape/validations/single_attribute_iterator_spec.rb
481
- - spec/grape/validations/types/array_coercer_spec.rb
482
464
  - spec/grape/validations/types/primitive_coercer_spec.rb
483
465
  - spec/grape/validations/types/set_coercer_spec.rb
466
+ - spec/grape/validations/types/array_coercer_spec.rb
467
+ - spec/grape/validations/attributes_doc_spec.rb
468
+ - spec/grape/validations/params_scope_spec.rb
469
+ - spec/grape/validations/instance_behaivour_spec.rb
470
+ - spec/grape/validations/multiple_attributes_iterator_spec.rb
484
471
  - spec/grape/validations/types_spec.rb
485
- - spec/grape/validations/validators/all_or_none_spec.rb
486
- - spec/grape/validations/validators/allow_blank_spec.rb
487
- - spec/grape/validations/validators/at_least_one_of_spec.rb
488
- - spec/grape/validations/validators/coerce_spec.rb
489
- - spec/grape/validations/validators/default_spec.rb
472
+ - spec/grape/validations/validators/regexp_spec.rb
473
+ - spec/grape/validations/validators/mutual_exclusion_spec.rb
490
474
  - spec/grape/validations/validators/exactly_one_of_spec.rb
491
475
  - spec/grape/validations/validators/except_values_spec.rb
492
- - spec/grape/validations/validators/mutual_exclusion_spec.rb
493
476
  - spec/grape/validations/validators/presence_spec.rb
494
- - spec/grape/validations/validators/regexp_spec.rb
477
+ - spec/grape/validations/validators/all_or_none_spec.rb
478
+ - spec/grape/validations/validators/allow_blank_spec.rb
495
479
  - spec/grape/validations/validators/same_as_spec.rb
480
+ - spec/grape/validations/validators/default_spec.rb
496
481
  - spec/grape/validations/validators/values_spec.rb
482
+ - spec/grape/validations/validators/at_least_one_of_spec.rb
483
+ - spec/grape/validations/validators/coerce_spec.rb
497
484
  - spec/grape/validations/validators/zh-CN.yml
498
- - spec/grape/validations_spec.rb
499
- - spec/integration/eager_load/eager_load_spec.rb
500
- - spec/integration/multi_json/json_spec.rb
501
- - spec/integration/multi_xml/xml_spec.rb
502
- - spec/shared/versioning_examples.rb
503
- - spec/spec_helper.rb
504
- - spec/support/basic_auth_encode_helpers.rb
505
- - spec/support/chunks.rb
506
- - spec/support/content_type_helpers.rb
507
- - spec/support/eager_load.rb
508
- - spec/support/endpoint_faker.rb
509
- - spec/support/file_streamer.rb
510
- - spec/support/integer_helpers.rb
511
- - spec/support/versioned_helpers.rb
485
+ - spec/grape/extensions/param_builders/hashie/mash_spec.rb
486
+ - spec/grape/extensions/param_builders/hash_spec.rb
487
+ - spec/grape/extensions/param_builders/hash_with_indifferent_access_spec.rb
488
+ - spec/grape/parser_spec.rb
489
+ - spec/grape/request_spec.rb
490
+ - spec/grape/endpoint/declared_spec.rb
491
+ - spec/grape/api/parameters_modification_spec.rb
492
+ - spec/grape/api/patch_method_helpers_spec.rb
493
+ - spec/grape/api/required_parameters_with_invalid_method_spec.rb
494
+ - spec/grape/api/nested_helpers_spec.rb
495
+ - spec/grape/api/defines_boolean_in_params_spec.rb
496
+ - spec/grape/api/invalid_format_spec.rb
497
+ - spec/grape/api/required_parameters_in_route_spec.rb
498
+ - spec/grape/api/instance_spec.rb
499
+ - spec/grape/api/namespace_parameters_in_route_spec.rb
500
+ - spec/grape/api/recognize_path_spec.rb
501
+ - spec/grape/api/shared_helpers_exactly_one_of_spec.rb
502
+ - spec/grape/api/inherited_helpers_spec.rb
503
+ - spec/grape/api/shared_helpers_spec.rb
504
+ - spec/grape/api/deeply_included_options_spec.rb
505
+ - spec/grape/api/routes_with_requirements_spec.rb
506
+ - spec/grape/api/custom_validations_spec.rb
507
+ - spec/grape/api/optional_parameters_in_route_spec.rb
508
+ - spec/grape/api/documentation_spec.rb
509
+ - spec/grape/api_remount_spec.rb
510
+ - spec/grape/named_api_spec.rb
511
+ - spec/grape/dsl/request_response_spec.rb
512
+ - spec/grape/dsl/desc_spec.rb
513
+ - spec/grape/dsl/logger_spec.rb
514
+ - spec/grape/dsl/validations_spec.rb
515
+ - spec/grape/dsl/parameters_spec.rb
516
+ - spec/grape/dsl/helpers_spec.rb
517
+ - spec/grape/dsl/middleware_spec.rb
518
+ - spec/grape/dsl/headers_spec.rb
519
+ - spec/grape/dsl/callbacks_spec.rb
520
+ - spec/grape/dsl/settings_spec.rb
521
+ - spec/grape/dsl/routing_spec.rb
522
+ - spec/grape/dsl/inside_route_spec.rb
523
+ - spec/grape/path_spec.rb
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- module Grape
6
- module DSL
7
- module ConfigurationSpec
8
- class Dummy
9
- include Grape::DSL::Configuration
10
- end
11
- end
12
- describe Configuration do
13
- subject { Class.new(ConfigurationSpec::Dummy) }
14
- end
15
- end
16
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Grape::Validations::AttributesIterator do
6
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Grape uses autoload https://api.rubyonrails.org/classes/ActiveSupport/Autoload.html.
4
- # When a class/module get added to the list, ActiveSupport doesn't check whether it really exists.
5
- # This method loads all classes/modules defined via autoload to be sure only existing
6
- # classes/modules were listed.
7
- def eager_load!(scope = Grape)
8
- # get modules
9
- scope.constants.each do |const_name|
10
- const = scope.const_get(const_name)
11
-
12
- next unless const.respond_to?(:eager_load!)
13
-
14
- const.eager_load!
15
-
16
- # check its modules, they might need to be loaded as well.
17
- eager_load!(const)
18
- end
19
- end