grape 1.2.5 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +45 -0
  3. data/README.md +7 -6
  4. data/UPGRADING.md +43 -0
  5. data/grape.gemspec +10 -1
  6. data/lib/grape/api/helpers.rb +2 -0
  7. data/lib/grape/api/instance.rb +8 -6
  8. data/lib/grape/api.rb +4 -2
  9. data/lib/grape/config.rb +2 -0
  10. data/lib/grape/content_types.rb +34 -0
  11. data/lib/grape/cookies.rb +2 -0
  12. data/lib/grape/dsl/api.rb +2 -0
  13. data/lib/grape/dsl/callbacks.rb +2 -0
  14. data/lib/grape/dsl/configuration.rb +2 -0
  15. data/lib/grape/dsl/desc.rb +2 -0
  16. data/lib/grape/dsl/headers.rb +2 -0
  17. data/lib/grape/dsl/helpers.rb +4 -2
  18. data/lib/grape/dsl/inside_route.rb +15 -11
  19. data/lib/grape/dsl/logger.rb +2 -0
  20. data/lib/grape/dsl/middleware.rb +2 -0
  21. data/lib/grape/dsl/parameters.rb +8 -6
  22. data/lib/grape/dsl/request_response.rb +4 -2
  23. data/lib/grape/dsl/routing.rb +9 -5
  24. data/lib/grape/dsl/settings.rb +7 -1
  25. data/lib/grape/dsl/validations.rb +2 -0
  26. data/lib/grape/eager_load.rb +2 -0
  27. data/lib/grape/endpoint.rb +13 -7
  28. data/lib/grape/error_formatter/base.rb +2 -0
  29. data/lib/grape/error_formatter/json.rb +2 -0
  30. data/lib/grape/error_formatter/txt.rb +2 -0
  31. data/lib/grape/error_formatter/xml.rb +2 -0
  32. data/lib/grape/error_formatter.rb +3 -1
  33. data/lib/grape/exceptions/base.rb +11 -13
  34. data/lib/grape/exceptions/incompatible_option_values.rb +2 -0
  35. data/lib/grape/exceptions/invalid_accept_header.rb +2 -0
  36. data/lib/grape/exceptions/invalid_formatter.rb +2 -0
  37. data/lib/grape/exceptions/invalid_message_body.rb +2 -0
  38. data/lib/grape/exceptions/invalid_response.rb +2 -0
  39. data/lib/grape/exceptions/invalid_version_header.rb +2 -0
  40. data/lib/grape/exceptions/invalid_versioner_option.rb +2 -0
  41. data/lib/grape/exceptions/invalid_with_option_for_represent.rb +2 -0
  42. data/lib/grape/exceptions/method_not_allowed.rb +2 -0
  43. data/lib/grape/exceptions/missing_group_type.rb +2 -0
  44. data/lib/grape/exceptions/missing_mime_type.rb +2 -0
  45. data/lib/grape/exceptions/missing_option.rb +2 -0
  46. data/lib/grape/exceptions/missing_vendor_option.rb +2 -0
  47. data/lib/grape/exceptions/unknown_options.rb +2 -0
  48. data/lib/grape/exceptions/unknown_parameter.rb +2 -0
  49. data/lib/grape/exceptions/unknown_validator.rb +2 -0
  50. data/lib/grape/exceptions/unsupported_group_type.rb +2 -0
  51. data/lib/grape/exceptions/validation.rb +3 -1
  52. data/lib/grape/exceptions/validation_array_errors.rb +2 -0
  53. data/lib/grape/exceptions/validation_errors.rb +13 -12
  54. data/lib/grape/extensions/active_support/hash_with_indifferent_access.rb +4 -3
  55. data/lib/grape/extensions/deep_mergeable_hash.rb +2 -0
  56. data/lib/grape/extensions/deep_symbolize_hash.rb +2 -0
  57. data/lib/grape/extensions/hash.rb +2 -0
  58. data/lib/grape/extensions/hashie/mash.rb +2 -0
  59. data/lib/grape/formatter/json.rb +2 -0
  60. data/lib/grape/formatter/serializable_hash.rb +2 -0
  61. data/lib/grape/formatter/txt.rb +2 -0
  62. data/lib/grape/formatter/xml.rb +2 -0
  63. data/lib/grape/formatter.rb +5 -3
  64. data/lib/grape/http/headers.rb +49 -18
  65. data/lib/grape/middleware/auth/base.rb +2 -0
  66. data/lib/grape/middleware/auth/dsl.rb +2 -0
  67. data/lib/grape/middleware/auth/strategies.rb +2 -0
  68. data/lib/grape/middleware/auth/strategy_info.rb +2 -0
  69. data/lib/grape/middleware/base.rb +5 -5
  70. data/lib/grape/middleware/error.rb +3 -1
  71. data/lib/grape/middleware/filter.rb +2 -0
  72. data/lib/grape/middleware/formatter.rb +5 -3
  73. data/lib/grape/middleware/globals.rb +2 -0
  74. data/lib/grape/middleware/helpers.rb +2 -0
  75. data/lib/grape/middleware/stack.rb +4 -1
  76. data/lib/grape/middleware/versioner/accept_version_header.rb +2 -0
  77. data/lib/grape/middleware/versioner/header.rb +5 -3
  78. data/lib/grape/middleware/versioner/param.rb +3 -1
  79. data/lib/grape/middleware/versioner/parse_media_type_patch.rb +2 -0
  80. data/lib/grape/middleware/versioner/path.rb +3 -1
  81. data/lib/grape/middleware/versioner.rb +2 -0
  82. data/lib/grape/namespace.rb +14 -2
  83. data/lib/grape/parser/json.rb +2 -0
  84. data/lib/grape/parser/xml.rb +2 -0
  85. data/lib/grape/parser.rb +3 -1
  86. data/lib/grape/path.rb +13 -1
  87. data/lib/grape/presenters/presenter.rb +2 -0
  88. data/lib/grape/request.rb +15 -8
  89. data/lib/grape/router/attribute_translator.rb +18 -8
  90. data/lib/grape/router/pattern.rb +20 -16
  91. data/lib/grape/router/route.rb +9 -4
  92. data/lib/grape/router.rb +26 -12
  93. data/lib/grape/serve_file/file_body.rb +2 -0
  94. data/lib/grape/serve_file/file_response.rb +2 -0
  95. data/lib/grape/serve_file/sendfile_response.rb +2 -0
  96. data/lib/grape/util/base_inheritable.rb +6 -0
  97. data/lib/grape/util/cache.rb +20 -0
  98. data/lib/grape/util/endpoint_configuration.rb +2 -0
  99. data/lib/grape/util/env.rb +19 -17
  100. data/lib/grape/util/inheritable_setting.rb +2 -0
  101. data/lib/grape/util/inheritable_values.rb +2 -0
  102. data/lib/grape/util/json.rb +2 -0
  103. data/lib/grape/util/lazy_block.rb +2 -0
  104. data/lib/grape/util/lazy_object.rb +43 -0
  105. data/lib/grape/util/lazy_value.rb +2 -0
  106. data/lib/grape/util/registrable.rb +2 -0
  107. data/lib/grape/util/reverse_stackable_values.rb +3 -1
  108. data/lib/grape/util/stackable_values.rb +9 -21
  109. data/lib/grape/util/strict_hash_configuration.rb +2 -0
  110. data/lib/grape/util/xml.rb +2 -0
  111. data/lib/grape/validations/attributes_iterator.rb +3 -3
  112. data/lib/grape/validations/multiple_attributes_iterator.rb +2 -0
  113. data/lib/grape/validations/params_scope.rb +24 -11
  114. data/lib/grape/validations/single_attribute_iterator.rb +13 -2
  115. data/lib/grape/validations/types/array_coercer.rb +56 -0
  116. data/lib/grape/validations/types/build_coercer.rb +49 -48
  117. data/lib/grape/validations/types/custom_type_coercer.rb +15 -49
  118. data/lib/grape/validations/types/custom_type_collection_coercer.rb +10 -25
  119. data/lib/grape/validations/types/dry_type_coercer.rb +41 -0
  120. data/lib/grape/validations/types/file.rb +11 -9
  121. data/lib/grape/validations/types/json.rb +11 -8
  122. data/lib/grape/validations/types/multiple_type_coercer.rb +14 -33
  123. data/lib/grape/validations/types/primitive_coercer.rb +61 -0
  124. data/lib/grape/validations/types/set_coercer.rb +38 -0
  125. data/lib/grape/validations/types/variant_collection_coercer.rb +4 -12
  126. data/lib/grape/validations/types.rb +7 -30
  127. data/lib/grape/validations/validator_factory.rb +2 -0
  128. data/lib/grape/validations/validators/all_or_none.rb +3 -1
  129. data/lib/grape/validations/validators/allow_blank.rb +3 -1
  130. data/lib/grape/validations/validators/as.rb +2 -0
  131. data/lib/grape/validations/validators/at_least_one_of.rb +3 -1
  132. data/lib/grape/validations/validators/base.rb +8 -5
  133. data/lib/grape/validations/validators/coerce.rb +44 -27
  134. data/lib/grape/validations/validators/default.rb +2 -0
  135. data/lib/grape/validations/validators/exactly_one_of.rb +6 -2
  136. data/lib/grape/validations/validators/except_values.rb +3 -1
  137. data/lib/grape/validations/validators/multiple_params_base.rb +2 -0
  138. data/lib/grape/validations/validators/mutual_exclusion.rb +3 -1
  139. data/lib/grape/validations/validators/presence.rb +3 -1
  140. data/lib/grape/validations/validators/regexp.rb +3 -1
  141. data/lib/grape/validations/validators/same_as.rb +6 -3
  142. data/lib/grape/validations/validators/values.rb +17 -5
  143. data/lib/grape/validations.rb +2 -0
  144. data/lib/grape/version.rb +3 -1
  145. data/lib/grape.rb +4 -5
  146. data/spec/grape/api/custom_validations_spec.rb +5 -3
  147. data/spec/grape/api/deeply_included_options_spec.rb +2 -0
  148. data/spec/grape/api/defines_boolean_in_params_spec.rb +5 -3
  149. data/spec/grape/api/inherited_helpers_spec.rb +2 -0
  150. data/spec/grape/api/instance_spec.rb +54 -0
  151. data/spec/grape/api/invalid_format_spec.rb +2 -0
  152. data/spec/grape/api/namespace_parameters_in_route_spec.rb +2 -0
  153. data/spec/grape/api/nested_helpers_spec.rb +2 -0
  154. data/spec/grape/api/optional_parameters_in_route_spec.rb +2 -0
  155. data/spec/grape/api/parameters_modification_spec.rb +3 -1
  156. data/spec/grape/api/patch_method_helpers_spec.rb +2 -0
  157. data/spec/grape/api/recognize_path_spec.rb +2 -0
  158. data/spec/grape/api/required_parameters_in_route_spec.rb +2 -0
  159. data/spec/grape/api/required_parameters_with_invalid_method_spec.rb +2 -0
  160. data/spec/grape/api/routes_with_requirements_spec.rb +2 -0
  161. data/spec/grape/api/shared_helpers_exactly_one_of_spec.rb +2 -0
  162. data/spec/grape/api/shared_helpers_spec.rb +2 -0
  163. data/spec/grape/api_remount_spec.rb +2 -0
  164. data/spec/grape/api_spec.rb +34 -11
  165. data/spec/grape/config_spec.rb +2 -0
  166. data/spec/grape/dsl/callbacks_spec.rb +2 -0
  167. data/spec/grape/dsl/configuration_spec.rb +2 -0
  168. data/spec/grape/dsl/desc_spec.rb +2 -0
  169. data/spec/grape/dsl/headers_spec.rb +2 -0
  170. data/spec/grape/dsl/helpers_spec.rb +4 -2
  171. data/spec/grape/dsl/inside_route_spec.rb +2 -0
  172. data/spec/grape/dsl/logger_spec.rb +2 -0
  173. data/spec/grape/dsl/middleware_spec.rb +2 -0
  174. data/spec/grape/dsl/parameters_spec.rb +2 -0
  175. data/spec/grape/dsl/request_response_spec.rb +2 -0
  176. data/spec/grape/dsl/routing_spec.rb +2 -0
  177. data/spec/grape/dsl/settings_spec.rb +2 -0
  178. data/spec/grape/dsl/validations_spec.rb +2 -0
  179. data/spec/grape/endpoint_spec.rb +3 -1
  180. data/spec/grape/entity_spec.rb +2 -0
  181. data/spec/grape/exceptions/base_spec.rb +3 -1
  182. data/spec/grape/exceptions/body_parse_errors_spec.rb +2 -0
  183. data/spec/grape/exceptions/invalid_accept_header_spec.rb +2 -0
  184. data/spec/grape/exceptions/invalid_formatter_spec.rb +2 -0
  185. data/spec/grape/exceptions/invalid_response_spec.rb +2 -0
  186. data/spec/grape/exceptions/invalid_versioner_option_spec.rb +2 -0
  187. data/spec/grape/exceptions/missing_mime_type_spec.rb +2 -0
  188. data/spec/grape/exceptions/missing_option_spec.rb +2 -0
  189. data/spec/grape/exceptions/unknown_options_spec.rb +2 -0
  190. data/spec/grape/exceptions/unknown_validator_spec.rb +2 -0
  191. data/spec/grape/exceptions/validation_errors_spec.rb +4 -2
  192. data/spec/grape/exceptions/validation_spec.rb +3 -1
  193. data/spec/grape/extensions/param_builders/hash_spec.rb +2 -0
  194. data/spec/grape/extensions/param_builders/hash_with_indifferent_access_spec.rb +2 -0
  195. data/spec/grape/extensions/param_builders/hashie/mash_spec.rb +2 -0
  196. data/spec/grape/integration/global_namespace_function_spec.rb +2 -0
  197. data/spec/grape/integration/rack_sendfile_spec.rb +2 -0
  198. data/spec/grape/integration/rack_spec.rb +3 -1
  199. data/spec/grape/loading_spec.rb +2 -0
  200. data/spec/grape/middleware/auth/base_spec.rb +2 -0
  201. data/spec/grape/middleware/auth/dsl_spec.rb +2 -0
  202. data/spec/grape/middleware/auth/strategies_spec.rb +2 -0
  203. data/spec/grape/middleware/base_spec.rb +2 -0
  204. data/spec/grape/middleware/error_spec.rb +2 -0
  205. data/spec/grape/middleware/exception_spec.rb +3 -1
  206. data/spec/grape/middleware/formatter_spec.rb +19 -12
  207. data/spec/grape/middleware/globals_spec.rb +2 -0
  208. data/spec/grape/middleware/stack_spec.rb +11 -0
  209. data/spec/grape/middleware/versioner/accept_version_header_spec.rb +3 -1
  210. data/spec/grape/middleware/versioner/header_spec.rb +3 -1
  211. data/spec/grape/middleware/versioner/param_spec.rb +3 -1
  212. data/spec/grape/middleware/versioner/path_spec.rb +3 -1
  213. data/spec/grape/middleware/versioner_spec.rb +2 -0
  214. data/spec/grape/named_api_spec.rb +2 -0
  215. data/spec/grape/parser_spec.rb +7 -5
  216. data/spec/grape/path_spec.rb +2 -0
  217. data/spec/grape/presenters/presenter_spec.rb +2 -0
  218. data/spec/grape/request_spec.rb +2 -0
  219. data/spec/grape/util/inheritable_setting_spec.rb +2 -0
  220. data/spec/grape/util/inheritable_values_spec.rb +2 -0
  221. data/spec/grape/util/reverse_stackable_values_spec.rb +2 -0
  222. data/spec/grape/util/stackable_values_spec.rb +3 -1
  223. data/spec/grape/util/strict_hash_configuration_spec.rb +2 -0
  224. data/spec/grape/validations/attributes_iterator_spec.rb +2 -0
  225. data/spec/grape/validations/instance_behaivour_spec.rb +5 -3
  226. data/spec/grape/validations/multiple_attributes_iterator_spec.rb +2 -0
  227. data/spec/grape/validations/params_scope_spec.rb +3 -1
  228. data/spec/grape/validations/single_attribute_iterator_spec.rb +18 -4
  229. data/spec/grape/validations/types/primitive_coercer_spec.rb +75 -0
  230. data/spec/grape/validations/types_spec.rb +8 -35
  231. data/spec/grape/validations/validators/all_or_none_spec.rb +2 -0
  232. data/spec/grape/validations/validators/allow_blank_spec.rb +2 -0
  233. data/spec/grape/validations/validators/at_least_one_of_spec.rb +2 -0
  234. data/spec/grape/validations/validators/coerce_spec.rb +51 -110
  235. data/spec/grape/validations/validators/default_spec.rb +2 -0
  236. data/spec/grape/validations/validators/exactly_one_of_spec.rb +14 -12
  237. data/spec/grape/validations/validators/except_values_spec.rb +3 -1
  238. data/spec/grape/validations/validators/mutual_exclusion_spec.rb +2 -0
  239. data/spec/grape/validations/validators/presence_spec.rb +30 -0
  240. data/spec/grape/validations/validators/regexp_spec.rb +2 -0
  241. data/spec/grape/validations/validators/same_as_spec.rb +2 -0
  242. data/spec/grape/validations/validators/values_spec.rb +29 -4
  243. data/spec/grape/validations_spec.rb +69 -15
  244. data/spec/integration/multi_json/json_spec.rb +2 -0
  245. data/spec/integration/multi_xml/xml_spec.rb +2 -0
  246. data/spec/shared/versioning_examples.rb +2 -0
  247. data/spec/spec_helper.rb +18 -0
  248. data/spec/support/basic_auth_encode_helpers.rb +2 -0
  249. data/spec/support/content_type_helpers.rb +2 -0
  250. data/spec/support/eager_load.rb +19 -0
  251. data/spec/support/endpoint_faker.rb +2 -0
  252. data/spec/support/file_streamer.rb +2 -0
  253. data/spec/support/integer_helpers.rb +2 -0
  254. data/spec/support/versioned_helpers.rb +4 -2
  255. metadata +126 -112
  256. data/lib/grape/extensions/deep_hash_with_indifferent_access.rb +0 -18
  257. data/lib/grape/util/content_types.rb +0 -26
  258. data/lib/grape/validations/types/virtus_collection_patch.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8934b2070d7c44a7100315712c05ee9e76eff602290b30f475f6e2e324c5392c
4
- data.tar.gz: 0d618a852be97bf103c7f783702342b030440834fedd725b4e6a90e03a8b0556
3
+ metadata.gz: 1711dd2fb0f0c86757c7e73d780907efa87e3da54e0a999a4b45c276b5eec92c
4
+ data.tar.gz: f5ba49001d1816d92130f70fb1b63ae061d7d9250142605f706d75c207880ad9
5
5
  SHA512:
6
- metadata.gz: f11c651eb7dea86dd45065c04cdebcbb2635cf8136536850b245d4ad94eac921a4218f191cc5f523968cdc4708ee7ede49fce17de21b97b96edcd82426c06795
7
- data.tar.gz: 8266b0bf359c1ed96b7aacd9bbecacfe6ef5f406b94d54a1a9c6dfdbf18d95967f8c853f13dfab642631e261f81893bcc5323e83c0d27a04226bdc03d7b19381
6
+ metadata.gz: 8b2dcf4d4903e3923dd10086a3371258404756cf294cd42c6fb64f3d2520fe7243c0accfe1b68f2e02fbaa85f29396c161d830cde4c5fdedd660b31e8d223a7f
7
+ data.tar.gz: 88a4d5e9740495430cd28ed1e213d6aafd92895c1b7966bd6358dd6aeb5b2e1f16eac2e14834d63e7791a6d66e16475ef30cdef5e37d10bca0f38f1d1a22c1e4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,48 @@
1
+ ### 1.3.1 (2020/03/11)
2
+
3
+ #### Features
4
+
5
+ * [#2005](https://github.com/ruby-grape/grape/pull/2005): Content types registrable - [@ericproulx](https://github.com/ericproulx).
6
+ * [#2003](https://github.com/ruby-grape/grape/pull/2003): Upgraded Rubocop to 0.80.1 - [@ericproulx](https://github.com/ericproulx).
7
+ * [#2002](https://github.com/ruby-grape/grape/pull/2002): Objects allocation optimization (lazy_lookup) - [@ericproulx](https://github.com/ericproulx).
8
+
9
+ #### Fixes
10
+
11
+ * [#2006](https://github.com/ruby-grape/grape/pull/2006): Fix explicit rescue StandardError - [@ericproulx](https://github.com/ericproulx).
12
+ * [#2004](https://github.com/ruby-grape/grape/pull/2004): Rubocop fixes - [@ericproulx](https://github.com/ericproulx).
13
+ * [#1995](https://github.com/ruby-grape/grape/pull/1995): Fix: "undefined instance variables" and "method redefined" warnings - [@nbeyer](https://github.com/nbeyer).
14
+ * [#1994](https://github.com/ruby-grape/grape/pull/1993): Fix typos in README - [@bellmyer](https://github.com/bellmyer).
15
+ * [#1993](https://github.com/ruby-grape/grape/pull/1993): Lazy join allow header - [@ericproulx](https://github.com/ericproulx).
16
+ * [#1987](https://github.com/ruby-grape/grape/pull/1987): Re-add exactly_one_of mutually exclusive error message - [@ZeroInputCtrl](https://github.com/ZeroInputCtrl).
17
+ * [#1977](https://github.com/ruby-grape/grape/pull/1977): Skip validation for a file if it is optional and nil - [@dnesteryuk](https://github.com/dnesteryuk).
18
+ * [#1976](https://github.com/ruby-grape/grape/pull/1976): Ensure classes/modules listed for autoload really exist - [@dnesteryuk](https://github.com/dnesteryuk).
19
+ * [#1971](https://github.com/ruby-grape/grape/pull/1971): Fix BigDecimal coercion - [@FlickStuart](https://github.com/FlickStuart).
20
+ * [#1968](https://github.com/ruby-grape/grape/pull/1968): Fix args forwarding in Grape::Middleware::Stack#merge_with for ruby 2.7.0 - [@dm1try](https://github.com/dm1try).
21
+ * [#1988](https://github.com/ruby-grape/grape/pull/1988): Refactored the full_messages method and stop overriding full_message - [@hosseintoussi](https://github.com/hosseintoussi).
22
+
23
+ ### 1.3.0 (2020/01/11)
24
+
25
+ #### Features
26
+
27
+ * [#1949](https://github.com/ruby-grape/grape/pull/1949): Add support for Ruby 2.7 - [@nbulaj](https://github.com/nbulaj).
28
+ * [#1948](https://github.com/ruby-grape/grape/pull/1948): Relax `dry-types` dependency version - [@nbulaj](https://github.com/nbulaj).
29
+ * [#1944](https://github.com/ruby-grape/grape/pull/1944): Reduces `attribute_translator` string allocations - [@ericproulx](https://github.com/ericproulx).
30
+ * [#1943](https://github.com/ruby-grape/grape/pull/1943): Reduces number of regex string allocations - [@ericproulx](https://github.com/ericproulx).
31
+ * [#1942](https://github.com/ruby-grape/grape/pull/1942): Optimizes retained memory methods - [@ericproulx](https://github.com/ericproulx).
32
+ * [#1941](https://github.com/ruby-grape/grape/pull/1941): Adds frozen string literal - [@ericproulx](https://github.com/ericproulx).
33
+ * [#1940](https://github.com/ruby-grape/grape/pull/1940): Gets rid of a needless step in `HashWithIndifferentAccess` - [@dnesteryuk](https://github.com/dnesteryuk).
34
+ * [#1938](https://github.com/ruby-grape/grape/pull/1938): Adds project metadata to the gemspec - [@orien](https://github.com/orien).
35
+ * [#1920](https://github.com/ruby-grape/grape/pull/1920): Replaces Virtus with dry-types - [@dnesteryuk](https://github.com/dnesteryuk).
36
+ * [#1930](https://github.com/ruby-grape/grape/pull/1930): Moves block call to separate method so it can be spied on - [@estolfo](https://github.com/estolfo).
37
+
38
+ #### Fixes
39
+
40
+ * [#1965](https://github.com/ruby-grape/grape/pull/1965): Fix typos in README - [@davidalee](https://github.com/davidalee).
41
+ * [#1963](https://github.com/ruby-grape/grape/pull/1963): The values validator must properly work with booleans - [@dnesteryuk](https://github.com/dnesteryuk).
42
+ * [#1950](https://github.com/ruby-grape/grape/pull/1950): Consider the allow_blank option in the values validator - [@dnesteryuk](https://github.com/dnesteryuk).
43
+ * [#1947](https://github.com/ruby-grape/grape/pull/1947): Careful check for empty params - [@dnesteryuk](https://github.com/dnesteryuk).
44
+ * [#1931](https://github.com/ruby-grape/grape/pull/1946): Fixes issue when using namespaces in `Grape::API::Instance` mounted directly - [@myxoh](https://github.com/myxoh).
45
+
1
46
  ### 1.2.5 (2019/12/01)
2
47
 
3
48
  #### Features
data/README.md CHANGED
@@ -154,8 +154,7 @@ content negotiation, versioning and much more.
154
154
 
155
155
  ## Stable Release
156
156
 
157
- You're reading the documentation for the stable release of Grape, **1.2.5**.
158
- Please read [UPGRADING](UPGRADING.md) when upgrading from a previous version.
157
+ You're reading the documentation for the stable release of Grape, **1.3.1**.
159
158
 
160
159
  ## Project Resources
161
160
 
@@ -166,6 +165,8 @@ Please read [UPGRADING](UPGRADING.md) when upgrading from a previous version.
166
165
 
167
166
  ## Installation
168
167
 
168
+ Ruby 2.4 or newer is required.
169
+
169
170
  Grape is available as a gem, to install it just install the gem:
170
171
 
171
172
  gem install grape
@@ -1720,7 +1721,7 @@ params do
1720
1721
  end
1721
1722
  ```
1722
1723
 
1723
- Every validation will have it's own instance of the validator, which means that the validator can have a state.
1724
+ Every validation will have its own instance of the validator, which means that the validator can have a state.
1724
1725
 
1725
1726
  ### Validation Errors
1726
1727
 
@@ -3226,7 +3227,7 @@ end
3226
3227
 
3227
3228
  Use [Doorkeeper](https://github.com/doorkeeper-gem/doorkeeper), [warden-oauth2](https://github.com/opperator/warden-oauth2) or [rack-oauth2](https://github.com/nov/rack-oauth2) for OAuth2 support.
3228
3229
 
3229
- You can access the controller params, headers, and helpers through the context with the `#context` method inside any auth middleware inherited from `Grape::Middlware::Auth::Base`.
3230
+ You can access the controller params, headers, and helpers through the context with the `#context` method inside any auth middleware inherited from `Grape::Middleware::Auth::Base`.
3230
3231
 
3231
3232
  ## Describing and Inspecting an API
3232
3233
 
@@ -3299,7 +3300,7 @@ end
3299
3300
 
3300
3301
  Blocks can be executed before or after every API call, using `before`, `after`,
3301
3302
  `before_validation` and `after_validation`.
3302
- If the API fails the `after` call will not be trigered, if you need code to execute for sure
3303
+ If the API fails the `after` call will not be triggered, if you need code to execute for sure
3303
3304
  use the `finally`.
3304
3305
 
3305
3306
  Before and after callbacks execute in the following order:
@@ -3540,7 +3541,7 @@ class API < Grape::API
3540
3541
  end
3541
3542
  ```
3542
3543
 
3543
- You can access the controller params, headers, and helpers through the context with the `#context` method inside any middleware inherited from `Grape::Middlware::Base`.
3544
+ You can access the controller params, headers, and helpers through the context with the `#context` method inside any middleware inherited from `Grape::Middleware::Base`.
3544
3545
 
3545
3546
  ### Rails Middleware
3546
3547
 
data/UPGRADING.md CHANGED
@@ -1,6 +1,49 @@
1
1
  Upgrading Grape
2
2
  ===============
3
3
 
4
+ ### Upgrading to >= 1.3.0
5
+
6
+ #### Ruby
7
+
8
+ After adding dry-types, Ruby 2.4 or newer is required.
9
+
10
+ #### Coercion
11
+
12
+ [Virtus](https://github.com/solnic/virtus) has been replaced by [dry-types](https://dry-rb.org/gems/dry-types/1.2/) for parameter coercion. If your project depends on Virtus, explicitly add it to your `Gemfile`. Also, if Virtus is used for defining custom types
13
+
14
+ ```ruby
15
+ class User
16
+ include Virtus.model
17
+
18
+ attribute :id, Integer
19
+ attribute :name, String
20
+ end
21
+
22
+ # somewhere in your API
23
+ params do
24
+ requires :user, type: User
25
+ end
26
+ ```
27
+
28
+ Add a class-level `parse` method to the model:
29
+
30
+ ```ruby
31
+ class User
32
+ include Virtus.model
33
+
34
+ attribute :id, Integer
35
+ attribute :name, String
36
+
37
+ def self.parse(attrs)
38
+ new(attrs)
39
+ end
40
+ end
41
+ ```
42
+
43
+ Custom types which don't depend on Virtus don't require any changes.
44
+
45
+ For more information see [#1920](https://github.com/ruby-grape/grape/pull/1920).
46
+
4
47
  ### Upgrading to >= 1.2.4
5
48
 
6
49
  #### Headers in `error!` call
data/grape.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
2
4
  require 'grape/version'
3
5
 
@@ -11,17 +13,24 @@ Gem::Specification.new do |s|
11
13
  s.summary = 'A simple Ruby framework for building REST-like APIs.'
12
14
  s.description = 'A Ruby framework for rapid API development with great conventions.'
13
15
  s.license = 'MIT'
16
+ s.metadata = {
17
+ 'bug_tracker_uri' => 'https://github.com/ruby-grape/grape/issues',
18
+ 'changelog_uri' => "https://github.com/ruby-grape/grape/blob/v#{s.version}/CHANGELOG.md",
19
+ 'documentation_uri' => "https://www.rubydoc.info/gems/grape/#{s.version}",
20
+ 'source_code_uri' => "https://github.com/ruby-grape/grape/tree/v#{s.version}"
21
+ }
14
22
 
15
23
  s.add_runtime_dependency 'activesupport'
16
24
  s.add_runtime_dependency 'builder'
25
+ s.add_runtime_dependency 'dry-types', '>= 1.1'
17
26
  s.add_runtime_dependency 'mustermann-grape', '~> 1.0.0'
18
27
  s.add_runtime_dependency 'rack', '>= 1.3.0'
19
28
  s.add_runtime_dependency 'rack-accept'
20
- s.add_runtime_dependency 'virtus', '>= 1.0.0'
21
29
 
22
30
  s.files = %w[CHANGELOG.md CONTRIBUTING.md README.md grape.png UPGRADING.md LICENSE]
23
31
  s.files += %w[grape.gemspec]
24
32
  s.files += Dir['lib/**/*']
25
33
  s.test_files = Dir['spec/**/*']
26
34
  s.require_paths = ['lib']
35
+ s.required_ruby_version = '>= 2.4.0'
27
36
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Grape
2
4
  class API
3
5
  module Helpers
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'grape/router'
2
4
 
3
5
  module Grape
@@ -72,7 +74,7 @@ module Grape
72
74
  # (see #cascade?)
73
75
  def cascade(value = nil)
74
76
  if value.nil?
75
- inheritable_setting.namespace_inheritable.keys.include?(:cascade) ? !namespace_inheritable(:cascade).nil? : true
77
+ inheritable_setting.namespace_inheritable.key?(:cascade) ? !namespace_inheritable(:cascade).nil? : true
76
78
  else
77
79
  namespace_inheritable(:cascade, value)
78
80
  end
@@ -119,7 +121,7 @@ module Grape
119
121
  self.configuration = value_for_configuration
120
122
  response
121
123
  end
122
- if base_instance? && lazy
124
+ if base && base_instance? && lazy
123
125
  lazy_block
124
126
  else
125
127
  lazy_block.evaluate_from(configuration)
@@ -176,7 +178,7 @@ module Grape
176
178
  # errors from reaching upstream. This is effectivelly done by unsetting
177
179
  # X-Cascade. Default :cascade is true.
178
180
  def cascade?
179
- return self.class.namespace_inheritable(:cascade) if self.class.inheritable_setting.namespace_inheritable.keys.include?(:cascade)
181
+ return self.class.namespace_inheritable(:cascade) if self.class.inheritable_setting.namespace_inheritable.key?(:cascade)
180
182
  return self.class.namespace_inheritable(:version_options)[:cascade] if self.class.namespace_inheritable(:version_options) && self.class.namespace_inheritable(:version_options).key?(:cascade)
181
183
  true
182
184
  end
@@ -207,7 +209,7 @@ module Grape
207
209
  route_settings[:endpoint] = route.app
208
210
 
209
211
  # using the :any shorthand produces [nil] for route methods, substitute all manually
210
- route_settings[:methods] = %w[GET PUT POST DELETE PATCH HEAD OPTIONS] if route_settings[:methods].include?('*')
212
+ route_settings[:methods] = Grape::Http::Headers::SUPPORTED_METHODS if route_settings[:methods].include?('*')
211
213
  end
212
214
  end
213
215
 
@@ -225,14 +227,14 @@ module Grape
225
227
  allowed_methods |= [Grape::Http::Headers::HEAD] if allowed_methods.include?(Grape::Http::Headers::GET)
226
228
  end
227
229
 
228
- allow_header = (self.class.namespace_inheritable(:do_not_route_options) ? allowed_methods : [Grape::Http::Headers::OPTIONS] | allowed_methods).join(', ')
230
+ allow_header = (self.class.namespace_inheritable(:do_not_route_options) ? allowed_methods : [Grape::Http::Headers::OPTIONS] | allowed_methods)
229
231
 
230
232
  unless self.class.namespace_inheritable(:do_not_route_options) || allowed_methods.include?(Grape::Http::Headers::OPTIONS)
231
233
  config[:endpoint].options[:options_route_enabled] = true
232
234
  end
233
235
 
234
236
  attributes = config.merge(allowed_methods: allowed_methods, allow_header: allow_header)
235
- generate_not_allowed_method(config[:pattern], attributes)
237
+ generate_not_allowed_method(config[:pattern], **attributes)
236
238
  end
237
239
  end
238
240
  end
data/lib/grape/api.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'grape/router'
2
4
  require 'grape/api/instance'
3
5
 
@@ -6,7 +8,7 @@ module Grape
6
8
  # should subclass this class in order to build an API.
7
9
  class API
8
10
  # Class methods that we want to call on the API rather than on the API object
9
- NON_OVERRIDABLE = (Class.new.methods + %i[call call! configuration compile!]).freeze
11
+ NON_OVERRIDABLE = (Class.new.methods + %i[call call! configuration compile! inherited]).freeze
10
12
 
11
13
  class << self
12
14
  attr_accessor :base_instance, :instances
@@ -173,7 +175,7 @@ module Grape
173
175
  if argument.respond_to?(:lazy?) && argument.lazy?
174
176
  argument.evaluate_from(configuration)
175
177
  elsif argument.is_a?(Hash)
176
- argument.map { |key, value| [key, evaluate_arguments(configuration, value).first] }.to_h
178
+ argument.transform_values { |value| evaluate_arguments(configuration, value).first }
177
179
  elsif argument.is_a?(Array)
178
180
  evaluate_arguments(configuration, *argument)
179
181
  else
data/lib/grape/config.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Grape
2
4
  module Config
3
5
  class Configuration
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'grape/util/registrable'
4
+
5
+ module Grape
6
+ module ContentTypes
7
+ extend Util::Registrable
8
+
9
+ # Content types are listed in order of preference.
10
+ CONTENT_TYPES = {
11
+ xml: 'application/xml',
12
+ serializable_hash: 'application/json',
13
+ json: 'application/json',
14
+ binary: 'application/octet-stream',
15
+ txt: 'text/plain'
16
+ }.freeze
17
+
18
+ class << self
19
+ def content_types_for_settings(settings)
20
+ return if settings.blank?
21
+
22
+ settings.each_with_object({}) { |value, result| result.merge!(value) }
23
+ end
24
+
25
+ def content_types_for(from_settings)
26
+ if from_settings.present?
27
+ from_settings
28
+ else
29
+ Grape::ContentTypes::CONTENT_TYPES.merge(default_elements)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
data/lib/grape/cookies.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Grape
2
4
  class Cookies
3
5
  def initialize
data/lib/grape/dsl/api.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern'
2
4
 
3
5
  module Grape
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern'
2
4
 
3
5
  module Grape
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern'
2
4
 
3
5
  module Grape
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Grape
2
4
  module DSL
3
5
  module Desc
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Grape
2
4
  module DSL
3
5
  module Headers
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern'
2
4
 
3
5
  module Grape
@@ -65,7 +67,7 @@ module Grape
65
67
 
66
68
  def define_boolean_in_mod(mod)
67
69
  return if defined? mod::Boolean
68
- mod.const_set('Boolean', Virtus::Attribute::Boolean)
70
+ mod.const_set('Boolean', Grape::API::Boolean)
69
71
  end
70
72
 
71
73
  def inject_api_helpers_to_mod(mod, &_block)
@@ -92,7 +94,7 @@ module Grape
92
94
  protected
93
95
 
94
96
  def process_named_params
95
- return unless @named_params && @named_params.any?
97
+ return unless instance_variable_defined?(:@named_params) && @named_params && @named_params.any?
96
98
  api.namespace_stackable(:named_params, @named_params)
97
99
  end
98
100
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern'
2
4
  require 'grape/dsl/headers'
3
5
 
@@ -28,7 +30,7 @@ module Grape
28
30
  module PostBeforeFilter
29
31
  def declared(passed_params, options = {}, declared_params = nil)
30
32
  options = options.reverse_merge(include_missing: true, include_parent_namespaces: true)
31
- declared_params ||= optioned_declared_params(options)
33
+ declared_params ||= optioned_declared_params(**options)
32
34
 
33
35
  if passed_params.is_a?(Array)
34
36
  declared_array(passed_params, options, declared_params)
@@ -84,7 +86,8 @@ module Grape
84
86
  end
85
87
 
86
88
  def declared_param_is_array?(declared_param)
87
- route_options_params[declared_param.to_s] && route_options_params[declared_param.to_s][:type] == 'Array'
89
+ key = declared_param.to_s
90
+ route_options_params[key] && route_options_params[key][:type] == 'Array'
88
91
  end
89
92
 
90
93
  def route_options_params
@@ -95,7 +98,7 @@ module Grape
95
98
  options[:stringify] ? declared_param.to_s : declared_param.to_sym
96
99
  end
97
100
 
98
- def optioned_declared_params(options)
101
+ def optioned_declared_params(**options)
99
102
  declared_params = if options[:include_parent_namespaces]
100
103
  # Declared params including parent namespaces
101
104
  route_setting(:saved_declared_params).flatten | Array(route_setting(:declared_params))
@@ -174,17 +177,17 @@ module Grape
174
177
  def status(status = nil)
175
178
  case status
176
179
  when Symbol
177
- raise ArgumentError, "Status code :#{status} is invalid." unless Rack::Utils::SYMBOL_TO_STATUS_CODE.keys.include?(status)
180
+ raise ArgumentError, "Status code :#{status} is invalid." unless Rack::Utils::SYMBOL_TO_STATUS_CODE.key?(status)
178
181
  @status = Rack::Utils.status_code(status)
179
182
  when Integer
180
183
  @status = status
181
184
  when nil
182
- return @status if @status
185
+ return @status if instance_variable_defined?(:@status) && @status
183
186
  case request.request_method.to_s.upcase
184
187
  when Grape::Http::Headers::POST
185
188
  201
186
189
  when Grape::Http::Headers::DELETE
187
- if @body.present?
190
+ if instance_variable_defined?(:@body) && @body.present?
188
191
  200
189
192
  else
190
193
  204
@@ -235,7 +238,7 @@ module Grape
235
238
  @body = ''
236
239
  status 204
237
240
  else
238
- @body
241
+ instance_variable_defined?(:@body) ? @body : nil
239
242
  end
240
243
  end
241
244
 
@@ -269,7 +272,7 @@ module Grape
269
272
  warn '[DEPRECATION] Argument as FileStreamer-like object is deprecated. Use path to file instead.'
270
273
  @file = Grape::ServeFile::FileResponse.new(value)
271
274
  else
272
- @file
275
+ instance_variable_defined?(:@file) ? @file : nil
273
276
  end
274
277
  end
275
278
 
@@ -328,11 +331,12 @@ module Grape
328
331
  end
329
332
 
330
333
  representation = { root => representation } if root
334
+
331
335
  if key
332
- representation = (@body || {}).merge(key => representation)
333
- elsif entity_class.present? && @body
336
+ representation = (body || {}).merge(key => representation)
337
+ elsif entity_class.present? && body
334
338
  raise ArgumentError, "Representation of type #{representation.class} cannot be merged." unless representation.respond_to?(:merge)
335
- representation = @body.merge(representation)
339
+ representation = body.merge(representation)
336
340
  end
337
341
 
338
342
  body representation
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Grape
2
4
  module DSL
3
5
  module Logger
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern'
2
4
 
3
5
  module Grape
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern'
2
4
 
3
5
  module Grape
@@ -125,13 +127,13 @@ module Grape
125
127
 
126
128
  opts = attrs.extract_options!.clone
127
129
  opts[:presence] = { value: true, message: opts[:message] }
128
- opts = @group.merge(opts) if @group
130
+ opts = @group.merge(opts) if instance_variable_defined?(:@group) && @group
129
131
 
130
132
  if opts[:using]
131
133
  require_required_and_optional_fields(attrs.first, opts)
132
134
  else
133
135
  validate_attributes(attrs, opts, &block)
134
- block_given? ? new_scope(orig_attrs, &block) : push_declared_params(attrs, opts.slice(:as))
136
+ block_given? ? new_scope(orig_attrs, &block) : push_declared_params(attrs, **opts.slice(:as))
135
137
  end
136
138
  end
137
139
 
@@ -144,7 +146,7 @@ module Grape
144
146
 
145
147
  opts = attrs.extract_options!.clone
146
148
  type = opts[:type]
147
- opts = @group.merge(opts) if @group
149
+ opts = @group.merge(opts) if instance_variable_defined?(:@group) && @group
148
150
 
149
151
  # check type for optional parameter group
150
152
  if attrs && block_given?
@@ -157,7 +159,7 @@ module Grape
157
159
  else
158
160
  validate_attributes(attrs, opts, &block)
159
161
 
160
- block_given? ? new_scope(orig_attrs, true, &block) : push_declared_params(attrs, opts.slice(:as))
162
+ block_given? ? new_scope(orig_attrs, true, &block) : push_declared_params(attrs, **opts.slice(:as))
161
163
  end
162
164
  end
163
165
 
@@ -241,8 +243,8 @@ module Grape
241
243
  # @return hash of parameters relevant for the current scope
242
244
  # @api private
243
245
  def params(params)
244
- params = @parent.params(params) if @parent
245
- params = map_params(params, @element) if @element
246
+ params = @parent.params(params) if instance_variable_defined?(:@parent) && @parent
247
+ params = map_params(params, @element) if instance_variable_defined?(:@element) && @element
246
248
  params
247
249
  end
248
250
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern'
2
4
 
3
5
  module Grape
@@ -20,7 +22,7 @@ module Grape
20
22
  if new_format
21
23
  namespace_inheritable(:format, new_format.to_sym)
22
24
  # define the default error formatters
23
- namespace_inheritable(:default_error_formatter, Grape::ErrorFormatter.formatter_for(new_format, {}))
25
+ namespace_inheritable(:default_error_formatter, Grape::ErrorFormatter.formatter_for(new_format, **{}))
24
26
  # define a single mime type
25
27
  mime_type = content_types[new_format.to_sym]
26
28
  raise Grape::Exceptions::MissingMimeType.new(new_format) unless mime_type
@@ -43,7 +45,7 @@ module Grape
43
45
  # Specify a default error formatter.
44
46
  def default_error_formatter(new_formatter_name = nil)
45
47
  if new_formatter_name
46
- new_formatter = Grape::ErrorFormatter.formatter_for(new_formatter_name, {})
48
+ new_formatter = Grape::ErrorFormatter.formatter_for(new_formatter_name, **{})
47
49
  namespace_inheritable(:default_error_formatter, new_formatter)
48
50
  else
49
51
  namespace_inheritable(:default_error_formatter)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern'
2
4
 
3
5
  module Grape
@@ -49,7 +51,7 @@ module Grape
49
51
  end
50
52
  end
51
53
 
52
- @versions.last unless @versions.nil?
54
+ @versions.last if instance_variable_defined?(:@versions) && @versions
53
55
  end
54
56
 
55
57
  # Define a root URL prefix for your entire API.
@@ -140,11 +142,11 @@ module Grape
140
142
  reset_validations!
141
143
  end
142
144
 
143
- %w[get post put head delete options patch].each do |meth|
144
- define_method meth do |*args, &block|
145
+ Grape::Http::Headers::SUPPORTED_METHODS.each do |supported_method|
146
+ define_method supported_method.downcase do |*args, &block|
145
147
  options = args.extract_options!
146
148
  paths = args.first || ['/']
147
- route(meth.upcase, paths, options, &block)
149
+ route(supported_method, paths, options, &block)
148
150
  end
149
151
  end
150
152
 
@@ -161,13 +163,15 @@ module Grape
161
163
  # end
162
164
  # end
163
165
  def namespace(space = nil, options = {}, &block)
166
+ @namespace_description = nil unless instance_variable_defined?(:@namespace_description) && @namespace_description
167
+
164
168
  if space || block_given?
165
169
  within_namespace do
166
170
  previous_namespace_description = @namespace_description
167
171
  @namespace_description = (@namespace_description || {}).deep_merge(namespace_setting(:description) || {})
168
172
  nest(block) do
169
173
  if space
170
- namespace_stackable(:namespace, Namespace.new(space, options))
174
+ namespace_stackable(:namespace, Namespace.new(space, **options))
171
175
  end
172
176
  end
173
177
  @namespace_description = previous_namespace_description
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern'
2
4
 
3
5
  module Grape
@@ -169,7 +171,11 @@ module Grape
169
171
  # the superclass's :inheritable_setting.
170
172
  def build_top_level_setting
171
173
  Grape::Util::InheritableSetting.new.tap do |setting|
172
- if defined?(superclass) && superclass.respond_to?(:inheritable_setting) && superclass != Grape::API
174
+ # Doesn't try to inherit settings from +Grape::API::Instance+ which also responds to
175
+ # +inheritable_setting+, however, it doesn't contain any user-defined settings.
176
+ # Otherwise, it would lead to an extra instance of +Grape::Util::InheritableSetting+
177
+ # in the chain for every endpoint.
178
+ if defined?(superclass) && superclass.respond_to?(:inheritable_setting) && superclass != Grape::API::Instance
173
179
  setting.inherit_from superclass.inheritable_setting
174
180
  end
175
181
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern'
2
4
 
3
5
  module Grape
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Grape.eager_load!
2
4
  Grape::Http.eager_load!
3
5
  Grape::Exceptions.eager_load!