grape 1.6.1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -0
  3. data/CONTRIBUTING.md +1 -1
  4. data/README.md +120 -19
  5. data/UPGRADING.md +19 -4
  6. data/lib/grape/api/instance.rb +1 -1
  7. data/lib/grape/dsl/api.rb +0 -2
  8. data/lib/grape/dsl/callbacks.rb +0 -2
  9. data/lib/grape/dsl/configuration.rb +0 -2
  10. data/lib/grape/dsl/desc.rb +0 -15
  11. data/lib/grape/dsl/helpers.rb +0 -2
  12. data/lib/grape/dsl/inside_route.rb +33 -29
  13. data/lib/grape/dsl/middleware.rb +0 -2
  14. data/lib/grape/dsl/parameters.rb +5 -7
  15. data/lib/grape/dsl/request_response.rb +0 -2
  16. data/lib/grape/dsl/routing.rb +4 -2
  17. data/lib/grape/dsl/settings.rb +0 -2
  18. data/lib/grape/dsl/validations.rb +0 -15
  19. data/lib/grape/error_formatter/json.rb +7 -1
  20. data/lib/grape/exceptions/base.rb +2 -2
  21. data/lib/grape/exceptions/missing_group_type.rb +8 -1
  22. data/lib/grape/exceptions/too_many_multipart_files.rb +11 -0
  23. data/lib/grape/exceptions/unsupported_group_type.rb +8 -1
  24. data/lib/grape/exceptions/validation.rb +0 -4
  25. data/lib/grape/locale/en.yml +9 -8
  26. data/lib/grape/middleware/auth/dsl.rb +0 -1
  27. data/lib/grape/middleware/error.rb +2 -2
  28. data/lib/grape/request.rb +2 -0
  29. data/lib/grape/validations/attributes_doc.rb +58 -0
  30. data/lib/grape/validations/params_scope.rb +66 -40
  31. data/lib/grape/validations/types/array_coercer.rb +2 -2
  32. data/lib/grape/validations/types/build_coercer.rb +94 -0
  33. data/lib/grape/validations/types/dry_type_coercer.rb +13 -8
  34. data/lib/grape/validations/types/json.rb +2 -0
  35. data/lib/grape/validations/types/primitive_coercer.rb +20 -10
  36. data/lib/grape/validations/types/set_coercer.rb +3 -2
  37. data/lib/grape/validations/types.rb +20 -26
  38. data/lib/grape/validations/validators/base.rb +7 -0
  39. data/lib/grape/validations.rb +16 -6
  40. data/lib/grape/version.rb +1 -1
  41. data/lib/grape.rb +20 -15
  42. data/spec/grape/api/custom_validations_spec.rb +41 -2
  43. data/spec/grape/api/deeply_included_options_spec.rb +0 -2
  44. data/spec/grape/api/defines_boolean_in_params_spec.rb +0 -2
  45. data/spec/grape/api/documentation_spec.rb +59 -0
  46. data/spec/grape/api/inherited_helpers_spec.rb +0 -2
  47. data/spec/grape/api/instance_spec.rb +0 -1
  48. data/spec/grape/api/invalid_format_spec.rb +0 -2
  49. data/spec/grape/api/namespace_parameters_in_route_spec.rb +0 -2
  50. data/spec/grape/api/nested_helpers_spec.rb +0 -2
  51. data/spec/grape/api/optional_parameters_in_route_spec.rb +0 -2
  52. data/spec/grape/api/parameters_modification_spec.rb +0 -2
  53. data/spec/grape/api/patch_method_helpers_spec.rb +0 -2
  54. data/spec/grape/api/recognize_path_spec.rb +0 -2
  55. data/spec/grape/api/required_parameters_in_route_spec.rb +0 -2
  56. data/spec/grape/api/required_parameters_with_invalid_method_spec.rb +0 -2
  57. data/spec/grape/api/routes_with_requirements_spec.rb +0 -2
  58. data/spec/grape/api/shared_helpers_exactly_one_of_spec.rb +0 -2
  59. data/spec/grape/api/shared_helpers_spec.rb +0 -2
  60. data/spec/grape/api_remount_spec.rb +0 -1
  61. data/spec/grape/api_spec.rb +18 -5
  62. data/spec/grape/config_spec.rb +0 -2
  63. data/spec/grape/dsl/callbacks_spec.rb +0 -2
  64. data/spec/grape/dsl/configuration_spec.rb +0 -2
  65. data/spec/grape/dsl/desc_spec.rb +0 -2
  66. data/spec/grape/dsl/headers_spec.rb +2 -4
  67. data/spec/grape/dsl/helpers_spec.rb +0 -2
  68. data/spec/grape/dsl/inside_route_spec.rb +10 -12
  69. data/spec/grape/dsl/logger_spec.rb +0 -2
  70. data/spec/grape/dsl/middleware_spec.rb +0 -2
  71. data/spec/grape/dsl/parameters_spec.rb +0 -2
  72. data/spec/grape/dsl/request_response_spec.rb +6 -8
  73. data/spec/grape/dsl/routing_spec.rb +1 -3
  74. data/spec/grape/dsl/settings_spec.rb +0 -2
  75. data/spec/grape/dsl/validations_spec.rb +0 -17
  76. data/spec/grape/endpoint/declared_spec.rb +2 -4
  77. data/spec/grape/endpoint_spec.rb +22 -3
  78. data/spec/grape/entity_spec.rb +0 -1
  79. data/spec/grape/exceptions/base_spec.rb +16 -2
  80. data/spec/grape/exceptions/body_parse_errors_spec.rb +0 -2
  81. data/spec/grape/exceptions/invalid_accept_header_spec.rb +0 -2
  82. data/spec/grape/exceptions/invalid_formatter_spec.rb +0 -2
  83. data/spec/grape/exceptions/invalid_response_spec.rb +0 -2
  84. data/spec/grape/exceptions/invalid_versioner_option_spec.rb +1 -3
  85. data/spec/grape/exceptions/missing_group_type_spec.rb +21 -0
  86. data/spec/grape/exceptions/missing_mime_type_spec.rb +0 -2
  87. data/spec/grape/exceptions/missing_option_spec.rb +1 -3
  88. data/spec/grape/exceptions/unknown_options_spec.rb +0 -2
  89. data/spec/grape/exceptions/unknown_validator_spec.rb +0 -2
  90. data/spec/grape/exceptions/unsupported_group_type_spec.rb +23 -0
  91. data/spec/grape/exceptions/validation_errors_spec.rb +0 -1
  92. data/spec/grape/exceptions/validation_spec.rb +1 -3
  93. data/spec/grape/extensions/param_builders/hash_spec.rb +0 -2
  94. data/spec/grape/extensions/param_builders/hash_with_indifferent_access_spec.rb +0 -2
  95. data/spec/grape/extensions/param_builders/hashie/mash_spec.rb +0 -2
  96. data/spec/grape/integration/global_namespace_function_spec.rb +0 -2
  97. data/spec/grape/integration/rack_sendfile_spec.rb +0 -2
  98. data/spec/grape/integration/rack_spec.rb +0 -2
  99. data/spec/grape/loading_spec.rb +0 -2
  100. data/spec/grape/middleware/auth/base_spec.rb +0 -1
  101. data/spec/grape/middleware/auth/dsl_spec.rb +0 -2
  102. data/spec/grape/middleware/auth/strategies_spec.rb +0 -2
  103. data/spec/grape/middleware/base_spec.rb +0 -2
  104. data/spec/grape/middleware/error_spec.rb +6 -1
  105. data/spec/grape/middleware/exception_spec.rb +0 -2
  106. data/spec/grape/middleware/formatter_spec.rb +0 -2
  107. data/spec/grape/middleware/globals_spec.rb +0 -2
  108. data/spec/grape/middleware/stack_spec.rb +0 -2
  109. data/spec/grape/middleware/versioner/accept_version_header_spec.rb +0 -2
  110. data/spec/grape/middleware/versioner/header_spec.rb +18 -4
  111. data/spec/grape/middleware/versioner/param_spec.rb +0 -2
  112. data/spec/grape/middleware/versioner/path_spec.rb +0 -2
  113. data/spec/grape/middleware/versioner_spec.rb +0 -2
  114. data/spec/grape/named_api_spec.rb +0 -2
  115. data/spec/grape/parser_spec.rb +0 -2
  116. data/spec/grape/path_spec.rb +0 -2
  117. data/spec/grape/presenters/presenter_spec.rb +0 -2
  118. data/spec/grape/request_spec.rb +0 -2
  119. data/spec/grape/util/inheritable_setting_spec.rb +0 -1
  120. data/spec/grape/util/inheritable_values_spec.rb +0 -1
  121. data/spec/grape/util/reverse_stackable_values_spec.rb +0 -1
  122. data/spec/grape/util/stackable_values_spec.rb +0 -1
  123. data/spec/grape/util/strict_hash_configuration_spec.rb +0 -1
  124. data/spec/grape/validations/attributes_doc_spec.rb +153 -0
  125. data/spec/grape/validations/attributes_iterator_spec.rb +0 -2
  126. data/spec/grape/validations/instance_behaivour_spec.rb +0 -2
  127. data/spec/grape/validations/multiple_attributes_iterator_spec.rb +0 -2
  128. data/spec/grape/validations/params_scope_spec.rb +315 -86
  129. data/spec/grape/validations/single_attribute_iterator_spec.rb +0 -2
  130. data/spec/grape/validations/types/array_coercer_spec.rb +0 -2
  131. data/spec/grape/validations/types/primitive_coercer_spec.rb +20 -5
  132. data/spec/grape/validations/types/set_coercer_spec.rb +0 -2
  133. data/spec/grape/validations/types_spec.rb +28 -2
  134. data/spec/grape/validations/validators/all_or_none_spec.rb +0 -2
  135. data/spec/grape/validations/validators/allow_blank_spec.rb +0 -2
  136. data/spec/grape/validations/validators/at_least_one_of_spec.rb +0 -2
  137. data/spec/grape/validations/validators/coerce_spec.rb +0 -2
  138. data/spec/grape/validations/validators/default_spec.rb +0 -2
  139. data/spec/grape/validations/validators/exactly_one_of_spec.rb +0 -2
  140. data/spec/grape/validations/validators/except_values_spec.rb +0 -2
  141. data/spec/grape/validations/validators/mutual_exclusion_spec.rb +0 -2
  142. data/spec/grape/validations/validators/presence_spec.rb +0 -2
  143. data/spec/grape/validations/validators/regexp_spec.rb +0 -2
  144. data/spec/grape/validations/validators/same_as_spec.rb +0 -2
  145. data/spec/grape/validations/validators/values_spec.rb +0 -2
  146. data/spec/grape/validations_spec.rb +50 -22
  147. data/spec/integration/multi_json/json_spec.rb +0 -2
  148. data/spec/integration/multi_xml/xml_spec.rb +0 -2
  149. data/spec/spec_helper.rb +9 -4
  150. metadata +17 -8
  151. data/spec/support/eager_load.rb +0 -19
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
4
-
5
3
  describe Grape::Validations::Validators::ValuesValidator do
6
4
  let_it_be(:values_model) do
7
5
  Class.new do
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
4
-
5
3
  describe Grape::Validations do
6
4
  subject { Class.new(Grape::API) }
7
5
 
@@ -45,7 +43,7 @@ describe Grape::Validations do
45
43
  subject.params do
46
44
  optional :some_param
47
45
  end
48
- expect(declared_params).to eq([:some_param])
46
+ expect(Grape::Validations::ParamsScope::Attr.attrs_keys(declared_params)).to eq([:some_param])
49
47
  end
50
48
  end
51
49
 
@@ -65,7 +63,7 @@ describe Grape::Validations do
65
63
 
66
64
  it 'adds entity documentation to declared params' do
67
65
  define_optional_using
68
- expect(declared_params).to eq(%i[field_a field_b])
66
+ expect(Grape::Validations::ParamsScope::Attr.attrs_keys(declared_params)).to eq(%i[field_a field_b])
69
67
  end
70
68
 
71
69
  it 'works when field_a and field_b are not present' do
@@ -112,7 +110,7 @@ describe Grape::Validations do
112
110
  subject.params do
113
111
  requires :some_param
114
112
  end
115
- expect(declared_params).to eq([:some_param])
113
+ expect(Grape::Validations::ParamsScope::Attr.attrs_keys(declared_params)).to eq([:some_param])
116
114
  end
117
115
 
118
116
  it 'works when required field is present but nil' do
@@ -197,7 +195,7 @@ describe Grape::Validations do
197
195
 
198
196
  it 'adds entity documentation to declared params' do
199
197
  define_requires_all
200
- expect(declared_params).to eq(%i[required_field optional_field])
198
+ expect(Grape::Validations::ParamsScope::Attr.attrs_keys(declared_params)).to eq(%i[required_field optional_field])
201
199
  end
202
200
 
203
201
  it 'errors when required_field is not present' do
@@ -232,7 +230,7 @@ describe Grape::Validations do
232
230
 
233
231
  it 'adds entity documentation to declared params' do
234
232
  define_requires_none
235
- expect(declared_params).to eq(%i[required_field optional_field])
233
+ expect(Grape::Validations::ParamsScope::Attr.attrs_keys(declared_params)).to eq(%i[required_field optional_field])
236
234
  end
237
235
 
238
236
  it 'errors when required_field is not present' do
@@ -262,7 +260,7 @@ describe Grape::Validations do
262
260
 
263
261
  it 'adds only the entity documentation to declared params, nothing more' do
264
262
  define_requires_all
265
- expect(declared_params).to eq(%i[required_field optional_field])
263
+ expect(Grape::Validations::ParamsScope::Attr.attrs_keys(declared_params)).to eq(%i[required_field optional_field])
266
264
  end
267
265
  end
268
266
 
@@ -328,7 +326,7 @@ describe Grape::Validations do
328
326
  requires :key
329
327
  end
330
328
  end
331
- expect(declared_params).to eq([items: [:key]])
329
+ expect(Grape::Validations::ParamsScope::Attr.attrs_keys(declared_params)).to eq([items: [:key]])
332
330
  end
333
331
  end
334
332
 
@@ -400,7 +398,7 @@ describe Grape::Validations do
400
398
  requires :key
401
399
  end
402
400
  end
403
- expect(declared_params).to eq([items: [:key]])
401
+ expect(Grape::Validations::ParamsScope::Attr.attrs_keys(declared_params)).to eq([items: [:key]])
404
402
  end
405
403
  end
406
404
 
@@ -463,7 +461,7 @@ describe Grape::Validations do
463
461
  requires :key
464
462
  end
465
463
  end
466
- expect(declared_params).to eq([items: [:key]])
464
+ expect(Grape::Validations::ParamsScope::Attr.attrs_keys(declared_params)).to eq([items: [:key]])
467
465
  end
468
466
  end
469
467
 
@@ -824,7 +822,7 @@ describe Grape::Validations do
824
822
  requires :key
825
823
  end
826
824
  end
827
- expect(declared_params).to eq([items: [:key]])
825
+ expect(Grape::Validations::ParamsScope::Attr.attrs_keys(declared_params)).to eq([items: [:key]])
828
826
  end
829
827
  end
830
828
 
@@ -888,7 +886,7 @@ describe Grape::Validations do
888
886
  requires(:required_subitems, type: Array) { requires :value }
889
887
  end
890
888
  end
891
- expect(declared_params).to eq([items: [:key, { optional_subitems: [:value] }, { required_subitems: [:value] }]])
889
+ expect(Grape::Validations::ParamsScope::Attr.attrs_keys(declared_params)).to eq([items: [:key, { optional_subitems: [:value] }, { required_subitems: [:value] }]])
892
890
  end
893
891
 
894
892
  context <<~DESC do
@@ -1428,14 +1426,14 @@ describe Grape::Validations do
1428
1426
  subject.params do
1429
1427
  use :pagination
1430
1428
  end
1431
- expect(declared_params).to eq %i[page per_page]
1429
+ expect(Grape::Validations::ParamsScope::Attr.attrs_keys(declared_params)).to eq %i[page per_page]
1432
1430
  end
1433
1431
 
1434
1432
  it 'by #use with multiple params' do
1435
1433
  subject.params do
1436
1434
  use :pagination, :period
1437
1435
  end
1438
- expect(declared_params).to eq %i[page per_page start_date end_date]
1436
+ expect(Grape::Validations::ParamsScope::Attr.attrs_keys(declared_params)).to eq %i[page per_page start_date end_date]
1439
1437
  end
1440
1438
  end
1441
1439
 
@@ -1485,17 +1483,29 @@ describe Grape::Validations do
1485
1483
  end
1486
1484
  end
1487
1485
 
1488
- context 'documentation' do
1489
- it 'can be included with a hash' do
1490
- documentation = { example: 'Joe' }
1491
-
1486
+ context 'with block and keyword argument' do
1487
+ before do
1488
+ subject.helpers do
1489
+ params :shared_params do |type:|
1490
+ optional :param, default: type
1491
+ end
1492
+ end
1493
+ subject.format :json
1492
1494
  subject.params do
1493
- requires 'first_name', documentation: documentation
1495
+ use :shared_params, type: 'value'
1494
1496
  end
1495
- subject.get '/' do
1497
+ subject.get '/shared_params' do
1498
+ {
1499
+ param: params[:param]
1500
+ }
1496
1501
  end
1502
+ end
1497
1503
 
1498
- expect(subject.routes.first.params['first_name'][:documentation]).to eq(documentation)
1504
+ it 'works' do
1505
+ get '/shared_params'
1506
+
1507
+ expect(last_response.status).to eq(200)
1508
+ expect(last_response.body).to eq({ param: 'value' }.to_json)
1499
1509
  end
1500
1510
  end
1501
1511
 
@@ -1975,4 +1985,22 @@ describe Grape::Validations do
1975
1985
  end
1976
1986
  end
1977
1987
  end
1988
+
1989
+ describe 'require_validator' do
1990
+ subject { described_class.require_validator(short_name) }
1991
+
1992
+ context 'when found' do
1993
+ let(:short_name) { :presence }
1994
+
1995
+ it { is_expected.to be(Grape::Validations::Validators::PresenceValidator) }
1996
+ end
1997
+
1998
+ context 'when not found' do
1999
+ let(:short_name) { :test }
2000
+
2001
+ it 'raises an error' do
2002
+ expect { subject }.to raise_error(Grape::Exceptions::UnknownValidator)
2003
+ end
2004
+ end
2005
+ end
1978
2006
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
4
-
5
3
  describe Grape::Json do
6
4
  it 'uses multi_json' do
7
5
  expect(described_class).to eq(::MultiJson)
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
4
-
5
3
  describe Grape::Xml do
6
4
  it 'uses multi_xml' do
7
5
  expect(described_class).to eq(::MultiXml)
data/spec/spec_helper.rb CHANGED
@@ -23,8 +23,6 @@ Dir["#{File.dirname(__FILE__)}/support/*.rb"].sort.each do |file|
23
23
  require file
24
24
  end
25
25
 
26
- eager_load!
27
-
28
26
  # The default value for this setting is true in a standard Rails app,
29
27
  # so it should be set to true here as well to reflect that.
30
28
  I18n.enforce_available_locales = true
@@ -43,5 +41,12 @@ RSpec.configure do |config|
43
41
  config.example_status_persistence_file_path = '.rspec_status'
44
42
  end
45
43
 
46
- require 'coveralls'
47
- Coveralls.wear!
44
+ require 'simplecov'
45
+ require 'simplecov-lcov'
46
+ SimpleCov::Formatter::LcovFormatter.config do |c|
47
+ c.report_with_single_file = true
48
+ c.single_report_path = 'coverage/lcov.info'
49
+ end
50
+
51
+ SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
52
+ SimpleCov.start
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.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-28 00:00:00.000000000 Z
11
+ date: 2022-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -152,6 +152,7 @@ files:
152
152
  - lib/grape/exceptions/missing_mime_type.rb
153
153
  - lib/grape/exceptions/missing_option.rb
154
154
  - lib/grape/exceptions/missing_vendor_option.rb
155
+ - lib/grape/exceptions/too_many_multipart_files.rb
155
156
  - lib/grape/exceptions/unknown_options.rb
156
157
  - lib/grape/exceptions/unknown_parameter.rb
157
158
  - lib/grape/exceptions/unknown_validator.rb
@@ -218,12 +219,14 @@ files:
218
219
  - lib/grape/util/strict_hash_configuration.rb
219
220
  - lib/grape/util/xml.rb
220
221
  - lib/grape/validations.rb
222
+ - lib/grape/validations/attributes_doc.rb
221
223
  - lib/grape/validations/attributes_iterator.rb
222
224
  - lib/grape/validations/multiple_attributes_iterator.rb
223
225
  - lib/grape/validations/params_scope.rb
224
226
  - lib/grape/validations/single_attribute_iterator.rb
225
227
  - lib/grape/validations/types.rb
226
228
  - lib/grape/validations/types/array_coercer.rb
229
+ - lib/grape/validations/types/build_coercer.rb
227
230
  - lib/grape/validations/types/custom_type_coercer.rb
228
231
  - lib/grape/validations/types/custom_type_collection_coercer.rb
229
232
  - lib/grape/validations/types/dry_type_coercer.rb
@@ -254,6 +257,7 @@ files:
254
257
  - spec/grape/api/custom_validations_spec.rb
255
258
  - spec/grape/api/deeply_included_options_spec.rb
256
259
  - spec/grape/api/defines_boolean_in_params_spec.rb
260
+ - spec/grape/api/documentation_spec.rb
257
261
  - spec/grape/api/inherited_helpers_spec.rb
258
262
  - spec/grape/api/instance_spec.rb
259
263
  - spec/grape/api/invalid_format_spec.rb
@@ -293,10 +297,12 @@ files:
293
297
  - spec/grape/exceptions/invalid_formatter_spec.rb
294
298
  - spec/grape/exceptions/invalid_response_spec.rb
295
299
  - spec/grape/exceptions/invalid_versioner_option_spec.rb
300
+ - spec/grape/exceptions/missing_group_type_spec.rb
296
301
  - spec/grape/exceptions/missing_mime_type_spec.rb
297
302
  - spec/grape/exceptions/missing_option_spec.rb
298
303
  - spec/grape/exceptions/unknown_options_spec.rb
299
304
  - spec/grape/exceptions/unknown_validator_spec.rb
305
+ - spec/grape/exceptions/unsupported_group_type_spec.rb
300
306
  - spec/grape/exceptions/validation_errors_spec.rb
301
307
  - spec/grape/exceptions/validation_spec.rb
302
308
  - spec/grape/extensions/param_builders/hash_spec.rb
@@ -330,6 +336,7 @@ files:
330
336
  - spec/grape/util/reverse_stackable_values_spec.rb
331
337
  - spec/grape/util/stackable_values_spec.rb
332
338
  - spec/grape/util/strict_hash_configuration_spec.rb
339
+ - spec/grape/validations/attributes_doc_spec.rb
333
340
  - spec/grape/validations/attributes_iterator_spec.rb
334
341
  - spec/grape/validations/instance_behaivour_spec.rb
335
342
  - spec/grape/validations/multiple_attributes_iterator_spec.rb
@@ -361,7 +368,6 @@ files:
361
368
  - spec/support/basic_auth_encode_helpers.rb
362
369
  - spec/support/chunks.rb
363
370
  - spec/support/content_type_helpers.rb
364
- - spec/support/eager_load.rb
365
371
  - spec/support/endpoint_faker.rb
366
372
  - spec/support/file_streamer.rb
367
373
  - spec/support/integer_helpers.rb
@@ -371,9 +377,9 @@ licenses:
371
377
  - MIT
372
378
  metadata:
373
379
  bug_tracker_uri: https://github.com/ruby-grape/grape/issues
374
- changelog_uri: https://github.com/ruby-grape/grape/blob/v1.6.1/CHANGELOG.md
375
- documentation_uri: https://www.rubydoc.info/gems/grape/1.6.1
376
- source_code_uri: https://github.com/ruby-grape/grape/tree/v1.6.1
380
+ changelog_uri: https://github.com/ruby-grape/grape/blob/v1.7.0/CHANGELOG.md
381
+ documentation_uri: https://www.rubydoc.info/gems/grape/1.7.0
382
+ source_code_uri: https://github.com/ruby-grape/grape/tree/v1.7.0
377
383
  post_install_message:
378
384
  rdoc_options: []
379
385
  require_paths:
@@ -389,7 +395,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
389
395
  - !ruby/object:Gem::Version
390
396
  version: '0'
391
397
  requirements: []
392
- rubygems_version: 3.3.0.dev
398
+ rubygems_version: 3.3.7
393
399
  signing_key:
394
400
  specification_version: 4
395
401
  summary: A simple Ruby framework for building REST-like APIs.
@@ -397,6 +403,7 @@ test_files:
397
403
  - spec/grape/api/custom_validations_spec.rb
398
404
  - spec/grape/api/deeply_included_options_spec.rb
399
405
  - spec/grape/api/defines_boolean_in_params_spec.rb
406
+ - spec/grape/api/documentation_spec.rb
400
407
  - spec/grape/api/inherited_helpers_spec.rb
401
408
  - spec/grape/api/instance_spec.rb
402
409
  - spec/grape/api/invalid_format_spec.rb
@@ -436,10 +443,12 @@ test_files:
436
443
  - spec/grape/exceptions/invalid_formatter_spec.rb
437
444
  - spec/grape/exceptions/invalid_response_spec.rb
438
445
  - spec/grape/exceptions/invalid_versioner_option_spec.rb
446
+ - spec/grape/exceptions/missing_group_type_spec.rb
439
447
  - spec/grape/exceptions/missing_mime_type_spec.rb
440
448
  - spec/grape/exceptions/missing_option_spec.rb
441
449
  - spec/grape/exceptions/unknown_options_spec.rb
442
450
  - spec/grape/exceptions/unknown_validator_spec.rb
451
+ - spec/grape/exceptions/unsupported_group_type_spec.rb
443
452
  - spec/grape/exceptions/validation_errors_spec.rb
444
453
  - spec/grape/exceptions/validation_spec.rb
445
454
  - spec/grape/extensions/param_builders/hash_spec.rb
@@ -473,6 +482,7 @@ test_files:
473
482
  - spec/grape/util/reverse_stackable_values_spec.rb
474
483
  - spec/grape/util/stackable_values_spec.rb
475
484
  - spec/grape/util/strict_hash_configuration_spec.rb
485
+ - spec/grape/validations/attributes_doc_spec.rb
476
486
  - spec/grape/validations/attributes_iterator_spec.rb
477
487
  - spec/grape/validations/instance_behaivour_spec.rb
478
488
  - spec/grape/validations/multiple_attributes_iterator_spec.rb
@@ -504,7 +514,6 @@ test_files:
504
514
  - spec/support/basic_auth_encode_helpers.rb
505
515
  - spec/support/chunks.rb
506
516
  - spec/support/content_type_helpers.rb
507
- - spec/support/eager_load.rb
508
517
  - spec/support/endpoint_faker.rb
509
518
  - spec/support/file_streamer.rb
510
519
  - spec/support/integer_helpers.rb
@@ -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