grape 2.4.0 → 4.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +351 -0
- data/CONTRIBUTING.md +18 -10
- data/README.md +457 -228
- data/UPGRADING.md +1240 -1
- data/grape.gemspec +7 -7
- data/lib/grape/api/instance.rb +65 -116
- data/lib/grape/api.rb +53 -62
- data/lib/grape/content_types.rb +58 -3
- data/lib/grape/cookies.rb +2 -6
- data/lib/grape/declared_params_handler.rb +116 -0
- data/lib/grape/dry_types.rb +48 -4
- data/lib/grape/dsl/callbacks.rb +8 -58
- data/lib/grape/dsl/declared.rb +35 -0
- data/lib/grape/dsl/desc.rb +24 -67
- data/lib/grape/dsl/entity.rb +106 -0
- data/lib/grape/dsl/helpers.rb +80 -65
- data/lib/grape/dsl/inside_route.rb +56 -296
- data/lib/grape/dsl/logger.rb +4 -9
- data/lib/grape/dsl/middleware.rb +22 -40
- data/lib/grape/dsl/parameters.rb +86 -93
- data/lib/grape/dsl/request_response.rb +139 -139
- data/lib/grape/dsl/rescue_options.rb +25 -0
- data/lib/grape/dsl/routing.rb +328 -203
- data/lib/grape/dsl/settings.rb +29 -135
- data/lib/grape/dsl/validations.rb +38 -44
- data/lib/grape/dsl/version_options.rb +23 -0
- data/lib/grape/endpoint/options.rb +25 -0
- data/lib/grape/endpoint.rb +285 -245
- data/lib/grape/env.rb +8 -3
- data/lib/grape/error_formatter/base.rb +27 -21
- data/lib/grape/error_formatter/json.rb +6 -0
- data/lib/grape/error_formatter/txt.rb +10 -10
- data/lib/grape/error_formatter.rb +6 -2
- data/lib/grape/exceptions/base.rb +20 -44
- data/lib/grape/exceptions/error_response.rb +48 -0
- data/lib/grape/exceptions/incompatible_option_values.rb +1 -1
- data/lib/grape/exceptions/internal_server_error.rb +16 -0
- data/lib/grape/exceptions/invalid_accept_header.rb +1 -1
- data/lib/grape/exceptions/invalid_formatter.rb +1 -1
- data/lib/grape/exceptions/invalid_message_body.rb +1 -1
- data/lib/grape/exceptions/invalid_version_header.rb +1 -1
- data/lib/grape/exceptions/invalid_versioner_option.rb +1 -1
- data/lib/grape/exceptions/method_not_allowed.rb +1 -1
- data/lib/grape/exceptions/missing_group_type.rb +0 -2
- data/lib/grape/exceptions/missing_mime_type.rb +1 -1
- data/lib/grape/exceptions/request_error.rb +11 -0
- data/lib/grape/exceptions/unknown_auth_strategy.rb +1 -1
- data/lib/grape/exceptions/unknown_error_formatter.rb +11 -0
- data/lib/grape/exceptions/unknown_parameter.rb +1 -1
- data/lib/grape/exceptions/unknown_params_builder.rb +1 -1
- data/lib/grape/exceptions/unknown_validator.rb +1 -1
- data/lib/grape/exceptions/unsupported_group_type.rb +0 -2
- data/lib/grape/exceptions/validation.rb +25 -7
- data/lib/grape/exceptions/validation_array_errors.rb +4 -0
- data/lib/grape/exceptions/validation_errors.rb +21 -23
- data/lib/grape/formatter/json.rb +1 -0
- data/lib/grape/formatter/serializable_hash.rb +6 -9
- data/lib/grape/json.rb +38 -2
- data/lib/grape/locale/en.yml +3 -5
- data/lib/grape/middleware/auth/base.rb +4 -3
- data/lib/grape/middleware/auth/dsl.rb +9 -23
- data/lib/grape/middleware/base.rb +41 -36
- data/lib/grape/middleware/error.rb +271 -73
- data/lib/grape/middleware/formatter.rb +152 -63
- data/lib/grape/middleware/precomputed_content_types.rb +51 -0
- data/lib/grape/middleware/stack.rb +20 -11
- data/lib/grape/middleware/versioner/accept_version_header.rb +3 -3
- data/lib/grape/middleware/versioner/base.rb +40 -48
- data/lib/grape/middleware/versioner/header.rb +5 -23
- data/lib/grape/middleware/versioner/param.rb +2 -2
- data/lib/grape/middleware/versioner/path.rb +54 -7
- data/lib/grape/mountable.rb +22 -0
- data/lib/grape/namespace.rb +19 -11
- data/lib/grape/params_builder/base.rb +2 -0
- data/lib/grape/params_builder/hash_with_indifferent_access.rb +1 -1
- data/lib/grape/params_builder.rb +2 -19
- data/lib/grape/parser/json.rb +1 -1
- data/lib/grape/path.rb +8 -72
- data/lib/grape/precompiled_json.rb +50 -0
- data/lib/grape/request.rb +57 -20
- data/lib/grape/router/base_route.rb +53 -7
- data/lib/grape/router/greedy_route.rb +16 -6
- data/lib/grape/router/mustermann_pattern.rb +44 -0
- data/lib/grape/router/pattern/path.rb +78 -0
- data/lib/grape/router/pattern.rb +65 -37
- data/lib/grape/router/route.rb +66 -18
- data/lib/grape/router.rb +126 -115
- data/lib/grape/serve_stream/file_body.rb +7 -0
- data/lib/grape/serve_stream/sendfile_response.rb +3 -5
- data/lib/grape/serve_stream/stream_response.rb +7 -0
- data/lib/grape/testing.rb +33 -0
- data/lib/grape/util/api_description.rb +67 -0
- data/lib/grape/util/cache.rb +22 -2
- data/lib/grape/util/deep_freeze.rb +34 -0
- data/lib/grape/util/freeze_on_new.rb +20 -0
- data/lib/grape/util/inheritable_setting.rb +777 -39
- data/lib/grape/util/lazy/base.rb +16 -0
- data/lib/grape/util/lazy/block.rb +2 -9
- data/lib/grape/util/lazy/value.rb +2 -9
- data/lib/grape/util/lazy/value_enumerable.rb +13 -16
- data/lib/grape/util/media_type.rb +13 -9
- data/lib/grape/util/path_normalizer.rb +37 -0
- data/lib/grape/util/registry.rb +13 -3
- data/lib/grape/util/shadowed_rescue_handlers.rb +49 -0
- data/lib/grape/util/stackable_values.rb +39 -10
- data/lib/grape/util/translation.rb +42 -0
- data/lib/grape/validations/attributes_iterator.rb +61 -29
- data/lib/grape/validations/coerce_options.rb +21 -0
- data/lib/grape/validations/contract_scope.rb +8 -13
- data/lib/grape/validations/multiple_attributes_iterator.rb +1 -1
- data/lib/grape/validations/oneof_collector.rb +35 -0
- data/lib/grape/validations/param_scope_tracker.rb +62 -0
- data/lib/grape/validations/params_documentation.rb +52 -0
- data/lib/grape/validations/params_scope.rb +217 -304
- data/lib/grape/validations/shared_options.rb +19 -0
- data/lib/grape/validations/single_attribute_iterator.rb +6 -4
- data/lib/grape/validations/types/array_coercer.rb +7 -10
- data/lib/grape/validations/types/custom_type_coercer.rb +47 -85
- data/lib/grape/validations/types/custom_type_collection_coercer.rb +1 -1
- data/lib/grape/validations/types/dry_type_coercer.rb +10 -15
- data/lib/grape/validations/types/json.rb +1 -3
- data/lib/grape/validations/types/multiple_type_coercer.rb +5 -3
- data/lib/grape/validations/types/primitive_coercer.rb +14 -33
- data/lib/grape/validations/types/set_coercer.rb +1 -1
- data/lib/grape/validations/types/variant_collection_coercer.rb +16 -3
- data/lib/grape/validations/types.rb +29 -51
- data/lib/grape/validations/validations_spec.rb +164 -0
- data/lib/grape/validations/validators/all_or_none_of_validator.rb +6 -3
- data/lib/grape/validations/validators/allow_blank_validator.rb +10 -5
- data/lib/grape/validations/validators/at_least_one_of_validator.rb +5 -2
- data/lib/grape/validations/validators/base.rb +118 -34
- data/lib/grape/validations/validators/coerce_validator.rb +25 -37
- data/lib/grape/validations/validators/contract_scope_validator.rb +10 -5
- data/lib/grape/validations/validators/default_validator.rb +13 -20
- data/lib/grape/validations/validators/exactly_one_of_validator.rb +10 -3
- data/lib/grape/validations/validators/except_values_validator.rb +14 -4
- data/lib/grape/validations/validators/length_validator.rb +23 -22
- data/lib/grape/validations/validators/multiple_params_base.rb +12 -9
- data/lib/grape/validations/validators/{mutual_exclusion_validator.rb → mutually_exclusive_validator.rb} +4 -2
- data/lib/grape/validations/validators/oneof_validator.rb +51 -0
- data/lib/grape/validations/validators/presence_validator.rb +4 -2
- data/lib/grape/validations/validators/regexp_validator.rb +11 -3
- data/lib/grape/validations/validators/same_as_validator.rb +7 -15
- data/lib/grape/validations/validators/values_validator.rb +34 -26
- data/lib/grape/version.rb +1 -2
- data/lib/grape/xml.rb +8 -1
- data/lib/grape.rb +58 -31
- metadata +62 -39
- data/lib/grape/api/helpers.rb +0 -9
- data/lib/grape/dsl/api.rb +0 -17
- data/lib/grape/dsl/configuration.rb +0 -15
- data/lib/grape/exceptions/conflicting_types.rb +0 -11
- data/lib/grape/exceptions/empty_message_body.rb +0 -11
- data/lib/grape/exceptions/invalid_parameters.rb +0 -11
- data/lib/grape/exceptions/missing_option.rb +0 -11
- data/lib/grape/exceptions/too_deep_parameters.rb +0 -11
- data/lib/grape/exceptions/too_many_multipart_files.rb +0 -11
- data/lib/grape/exceptions/unknown_options.rb +0 -11
- data/lib/grape/extensions/active_support/hash_with_indifferent_access.rb +0 -24
- data/lib/grape/extensions/hash.rb +0 -27
- data/lib/grape/extensions/hashie/mash.rb +0 -24
- data/lib/grape/middleware/globals.rb +0 -14
- data/lib/grape/types/invalid_value.rb +0 -8
- data/lib/grape/util/base_inheritable.rb +0 -43
- data/lib/grape/util/inheritable_values.rb +0 -29
- data/lib/grape/util/reverse_stackable_values.rb +0 -15
- data/lib/grape/util/strict_hash_configuration.rb +0 -108
- data/lib/grape/validations/attributes_doc.rb +0 -60
- data/lib/grape/validations/validator_factory.rb +0 -15
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: grape
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Bleigh
|
|
@@ -15,14 +15,28 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
18
|
+
version: '7.2'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '
|
|
25
|
+
version: '7.2'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: dry-configurable
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '1.0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '1.0'
|
|
26
40
|
- !ruby/object:Gem::Dependency
|
|
27
41
|
name: dry-types
|
|
28
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -38,47 +52,47 @@ dependencies:
|
|
|
38
52
|
- !ruby/object:Gem::Version
|
|
39
53
|
version: '1.1'
|
|
40
54
|
- !ruby/object:Gem::Dependency
|
|
41
|
-
name: mustermann
|
|
55
|
+
name: mustermann
|
|
42
56
|
requirement: !ruby/object:Gem::Requirement
|
|
43
57
|
requirements:
|
|
44
|
-
- - "
|
|
58
|
+
- - ">="
|
|
45
59
|
- !ruby/object:Gem::Version
|
|
46
|
-
version:
|
|
60
|
+
version: '4.0'
|
|
47
61
|
type: :runtime
|
|
48
62
|
prerelease: false
|
|
49
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
64
|
requirements:
|
|
51
|
-
- - "
|
|
65
|
+
- - ">="
|
|
52
66
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
67
|
+
version: '4.0'
|
|
54
68
|
- !ruby/object:Gem::Dependency
|
|
55
69
|
name: rack
|
|
56
70
|
requirement: !ruby/object:Gem::Requirement
|
|
57
71
|
requirements:
|
|
58
72
|
- - ">="
|
|
59
73
|
- !ruby/object:Gem::Version
|
|
60
|
-
version:
|
|
74
|
+
version: 2.2.4
|
|
61
75
|
type: :runtime
|
|
62
76
|
prerelease: false
|
|
63
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
78
|
requirements:
|
|
65
79
|
- - ">="
|
|
66
80
|
- !ruby/object:Gem::Version
|
|
67
|
-
version:
|
|
81
|
+
version: 2.2.4
|
|
68
82
|
- !ruby/object:Gem::Dependency
|
|
69
83
|
name: zeitwerk
|
|
70
84
|
requirement: !ruby/object:Gem::Requirement
|
|
71
85
|
requirements:
|
|
72
86
|
- - ">="
|
|
73
87
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '
|
|
88
|
+
version: '2.6'
|
|
75
89
|
type: :runtime
|
|
76
90
|
prerelease: false
|
|
77
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
92
|
requirements:
|
|
79
93
|
- - ">="
|
|
80
94
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '
|
|
95
|
+
version: '2.6'
|
|
82
96
|
description: A Ruby framework for rapid API development with great conventions.
|
|
83
97
|
email:
|
|
84
98
|
- michael@intridea.com
|
|
@@ -95,15 +109,15 @@ files:
|
|
|
95
109
|
- grape.png
|
|
96
110
|
- lib/grape.rb
|
|
97
111
|
- lib/grape/api.rb
|
|
98
|
-
- lib/grape/api/helpers.rb
|
|
99
112
|
- lib/grape/api/instance.rb
|
|
100
113
|
- lib/grape/content_types.rb
|
|
101
114
|
- lib/grape/cookies.rb
|
|
115
|
+
- lib/grape/declared_params_handler.rb
|
|
102
116
|
- lib/grape/dry_types.rb
|
|
103
|
-
- lib/grape/dsl/api.rb
|
|
104
117
|
- lib/grape/dsl/callbacks.rb
|
|
105
|
-
- lib/grape/dsl/
|
|
118
|
+
- lib/grape/dsl/declared.rb
|
|
106
119
|
- lib/grape/dsl/desc.rb
|
|
120
|
+
- lib/grape/dsl/entity.rb
|
|
107
121
|
- lib/grape/dsl/headers.rb
|
|
108
122
|
- lib/grape/dsl/helpers.rb
|
|
109
123
|
- lib/grape/dsl/inside_route.rb
|
|
@@ -111,10 +125,13 @@ files:
|
|
|
111
125
|
- lib/grape/dsl/middleware.rb
|
|
112
126
|
- lib/grape/dsl/parameters.rb
|
|
113
127
|
- lib/grape/dsl/request_response.rb
|
|
128
|
+
- lib/grape/dsl/rescue_options.rb
|
|
114
129
|
- lib/grape/dsl/routing.rb
|
|
115
130
|
- lib/grape/dsl/settings.rb
|
|
116
131
|
- lib/grape/dsl/validations.rb
|
|
132
|
+
- lib/grape/dsl/version_options.rb
|
|
117
133
|
- lib/grape/endpoint.rb
|
|
134
|
+
- lib/grape/endpoint/options.rb
|
|
118
135
|
- lib/grape/env.rb
|
|
119
136
|
- lib/grape/error_formatter.rb
|
|
120
137
|
- lib/grape/error_formatter/base.rb
|
|
@@ -123,13 +140,12 @@ files:
|
|
|
123
140
|
- lib/grape/error_formatter/txt.rb
|
|
124
141
|
- lib/grape/error_formatter/xml.rb
|
|
125
142
|
- lib/grape/exceptions/base.rb
|
|
126
|
-
- lib/grape/exceptions/
|
|
127
|
-
- lib/grape/exceptions/empty_message_body.rb
|
|
143
|
+
- lib/grape/exceptions/error_response.rb
|
|
128
144
|
- lib/grape/exceptions/incompatible_option_values.rb
|
|
145
|
+
- lib/grape/exceptions/internal_server_error.rb
|
|
129
146
|
- lib/grape/exceptions/invalid_accept_header.rb
|
|
130
147
|
- lib/grape/exceptions/invalid_formatter.rb
|
|
131
148
|
- lib/grape/exceptions/invalid_message_body.rb
|
|
132
|
-
- lib/grape/exceptions/invalid_parameters.rb
|
|
133
149
|
- lib/grape/exceptions/invalid_response.rb
|
|
134
150
|
- lib/grape/exceptions/invalid_version_header.rb
|
|
135
151
|
- lib/grape/exceptions/invalid_versioner_option.rb
|
|
@@ -137,12 +153,10 @@ files:
|
|
|
137
153
|
- lib/grape/exceptions/method_not_allowed.rb
|
|
138
154
|
- lib/grape/exceptions/missing_group_type.rb
|
|
139
155
|
- lib/grape/exceptions/missing_mime_type.rb
|
|
140
|
-
- lib/grape/exceptions/missing_option.rb
|
|
141
156
|
- lib/grape/exceptions/missing_vendor_option.rb
|
|
142
|
-
- lib/grape/exceptions/
|
|
143
|
-
- lib/grape/exceptions/too_many_multipart_files.rb
|
|
157
|
+
- lib/grape/exceptions/request_error.rb
|
|
144
158
|
- lib/grape/exceptions/unknown_auth_strategy.rb
|
|
145
|
-
- lib/grape/exceptions/
|
|
159
|
+
- lib/grape/exceptions/unknown_error_formatter.rb
|
|
146
160
|
- lib/grape/exceptions/unknown_parameter.rb
|
|
147
161
|
- lib/grape/exceptions/unknown_params_builder.rb
|
|
148
162
|
- lib/grape/exceptions/unknown_validator.rb
|
|
@@ -150,9 +164,6 @@ files:
|
|
|
150
164
|
- lib/grape/exceptions/validation.rb
|
|
151
165
|
- lib/grape/exceptions/validation_array_errors.rb
|
|
152
166
|
- lib/grape/exceptions/validation_errors.rb
|
|
153
|
-
- lib/grape/extensions/active_support/hash_with_indifferent_access.rb
|
|
154
|
-
- lib/grape/extensions/hash.rb
|
|
155
|
-
- lib/grape/extensions/hashie/mash.rb
|
|
156
167
|
- lib/grape/formatter.rb
|
|
157
168
|
- lib/grape/formatter/base.rb
|
|
158
169
|
- lib/grape/formatter/json.rb
|
|
@@ -169,7 +180,7 @@ files:
|
|
|
169
180
|
- lib/grape/middleware/error.rb
|
|
170
181
|
- lib/grape/middleware/filter.rb
|
|
171
182
|
- lib/grape/middleware/formatter.rb
|
|
172
|
-
- lib/grape/middleware/
|
|
183
|
+
- lib/grape/middleware/precomputed_content_types.rb
|
|
173
184
|
- lib/grape/middleware/stack.rb
|
|
174
185
|
- lib/grape/middleware/versioner.rb
|
|
175
186
|
- lib/grape/middleware/versioner/accept_version_header.rb
|
|
@@ -177,6 +188,7 @@ files:
|
|
|
177
188
|
- lib/grape/middleware/versioner/header.rb
|
|
178
189
|
- lib/grape/middleware/versioner/param.rb
|
|
179
190
|
- lib/grape/middleware/versioner/path.rb
|
|
191
|
+
- lib/grape/mountable.rb
|
|
180
192
|
- lib/grape/namespace.rb
|
|
181
193
|
- lib/grape/params_builder.rb
|
|
182
194
|
- lib/grape/params_builder/base.rb
|
|
@@ -188,40 +200,50 @@ files:
|
|
|
188
200
|
- lib/grape/parser/json.rb
|
|
189
201
|
- lib/grape/parser/xml.rb
|
|
190
202
|
- lib/grape/path.rb
|
|
203
|
+
- lib/grape/precompiled_json.rb
|
|
191
204
|
- lib/grape/presenters/presenter.rb
|
|
192
205
|
- lib/grape/railtie.rb
|
|
193
206
|
- lib/grape/request.rb
|
|
194
207
|
- lib/grape/router.rb
|
|
195
208
|
- lib/grape/router/base_route.rb
|
|
196
209
|
- lib/grape/router/greedy_route.rb
|
|
210
|
+
- lib/grape/router/mustermann_pattern.rb
|
|
197
211
|
- lib/grape/router/pattern.rb
|
|
212
|
+
- lib/grape/router/pattern/path.rb
|
|
198
213
|
- lib/grape/router/route.rb
|
|
199
214
|
- lib/grape/serve_stream/file_body.rb
|
|
200
215
|
- lib/grape/serve_stream/sendfile_response.rb
|
|
201
216
|
- lib/grape/serve_stream/stream_response.rb
|
|
202
|
-
- lib/grape/
|
|
203
|
-
- lib/grape/util/
|
|
217
|
+
- lib/grape/testing.rb
|
|
218
|
+
- lib/grape/util/api_description.rb
|
|
204
219
|
- lib/grape/util/cache.rb
|
|
220
|
+
- lib/grape/util/deep_freeze.rb
|
|
205
221
|
- lib/grape/util/endpoint_configuration.rb
|
|
222
|
+
- lib/grape/util/freeze_on_new.rb
|
|
206
223
|
- lib/grape/util/header.rb
|
|
207
224
|
- lib/grape/util/inheritable_setting.rb
|
|
208
|
-
- lib/grape/util/
|
|
225
|
+
- lib/grape/util/lazy/base.rb
|
|
209
226
|
- lib/grape/util/lazy/block.rb
|
|
210
227
|
- lib/grape/util/lazy/value.rb
|
|
211
228
|
- lib/grape/util/lazy/value_array.rb
|
|
212
229
|
- lib/grape/util/lazy/value_enumerable.rb
|
|
213
230
|
- lib/grape/util/lazy/value_hash.rb
|
|
214
231
|
- lib/grape/util/media_type.rb
|
|
232
|
+
- lib/grape/util/path_normalizer.rb
|
|
215
233
|
- lib/grape/util/registry.rb
|
|
216
|
-
- lib/grape/util/
|
|
234
|
+
- lib/grape/util/shadowed_rescue_handlers.rb
|
|
217
235
|
- lib/grape/util/stackable_values.rb
|
|
218
|
-
- lib/grape/util/
|
|
236
|
+
- lib/grape/util/translation.rb
|
|
219
237
|
- lib/grape/validations.rb
|
|
220
|
-
- lib/grape/validations/attributes_doc.rb
|
|
221
238
|
- lib/grape/validations/attributes_iterator.rb
|
|
239
|
+
- lib/grape/validations/coerce_options.rb
|
|
222
240
|
- lib/grape/validations/contract_scope.rb
|
|
223
241
|
- lib/grape/validations/multiple_attributes_iterator.rb
|
|
242
|
+
- lib/grape/validations/oneof_collector.rb
|
|
243
|
+
- lib/grape/validations/param_scope_tracker.rb
|
|
244
|
+
- lib/grape/validations/params_documentation.rb
|
|
224
245
|
- lib/grape/validations/params_scope.rb
|
|
246
|
+
- lib/grape/validations/shared_options.rb
|
|
225
247
|
- lib/grape/validations/single_attribute_iterator.rb
|
|
226
248
|
- lib/grape/validations/types.rb
|
|
227
249
|
- lib/grape/validations/types/array_coercer.rb
|
|
@@ -235,7 +257,7 @@ files:
|
|
|
235
257
|
- lib/grape/validations/types/primitive_coercer.rb
|
|
236
258
|
- lib/grape/validations/types/set_coercer.rb
|
|
237
259
|
- lib/grape/validations/types/variant_collection_coercer.rb
|
|
238
|
-
- lib/grape/validations/
|
|
260
|
+
- lib/grape/validations/validations_spec.rb
|
|
239
261
|
- lib/grape/validations/validators/all_or_none_of_validator.rb
|
|
240
262
|
- lib/grape/validations/validators/allow_blank_validator.rb
|
|
241
263
|
- lib/grape/validations/validators/as_validator.rb
|
|
@@ -248,7 +270,8 @@ files:
|
|
|
248
270
|
- lib/grape/validations/validators/except_values_validator.rb
|
|
249
271
|
- lib/grape/validations/validators/length_validator.rb
|
|
250
272
|
- lib/grape/validations/validators/multiple_params_base.rb
|
|
251
|
-
- lib/grape/validations/validators/
|
|
273
|
+
- lib/grape/validations/validators/mutually_exclusive_validator.rb
|
|
274
|
+
- lib/grape/validations/validators/oneof_validator.rb
|
|
252
275
|
- lib/grape/validations/validators/presence_validator.rb
|
|
253
276
|
- lib/grape/validations/validators/regexp_validator.rb
|
|
254
277
|
- lib/grape/validations/validators/same_as_validator.rb
|
|
@@ -260,9 +283,9 @@ licenses:
|
|
|
260
283
|
- MIT
|
|
261
284
|
metadata:
|
|
262
285
|
bug_tracker_uri: https://github.com/ruby-grape/grape/issues
|
|
263
|
-
changelog_uri: https://github.com/ruby-grape/grape/blob/
|
|
264
|
-
documentation_uri: https://www.rubydoc.info/gems/grape/
|
|
265
|
-
source_code_uri: https://github.com/ruby-grape/grape/tree/
|
|
286
|
+
changelog_uri: https://github.com/ruby-grape/grape/blob/v4.0.1/CHANGELOG.md
|
|
287
|
+
documentation_uri: https://www.rubydoc.info/gems/grape/4.0.1
|
|
288
|
+
source_code_uri: https://github.com/ruby-grape/grape/tree/v4.0.1
|
|
266
289
|
rubygems_mfa_required: 'true'
|
|
267
290
|
rdoc_options: []
|
|
268
291
|
require_paths:
|
|
@@ -271,14 +294,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
271
294
|
requirements:
|
|
272
295
|
- - ">="
|
|
273
296
|
- !ruby/object:Gem::Version
|
|
274
|
-
version:
|
|
297
|
+
version: '3.3'
|
|
275
298
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
276
299
|
requirements:
|
|
277
300
|
- - ">="
|
|
278
301
|
- !ruby/object:Gem::Version
|
|
279
302
|
version: '0'
|
|
280
303
|
requirements: []
|
|
281
|
-
rubygems_version:
|
|
304
|
+
rubygems_version: 4.0.16
|
|
282
305
|
specification_version: 4
|
|
283
306
|
summary: A simple Ruby framework for building REST-like APIs.
|
|
284
307
|
test_files: []
|
data/lib/grape/api/helpers.rb
DELETED
data/lib/grape/dsl/api.rb
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Grape
|
|
4
|
-
module DSL
|
|
5
|
-
module API
|
|
6
|
-
extend ActiveSupport::Concern
|
|
7
|
-
|
|
8
|
-
include Grape::DSL::Validations
|
|
9
|
-
include Grape::DSL::Callbacks
|
|
10
|
-
include Grape::DSL::Configuration
|
|
11
|
-
include Grape::DSL::Helpers
|
|
12
|
-
include Grape::DSL::Middleware
|
|
13
|
-
include Grape::DSL::RequestResponse
|
|
14
|
-
include Grape::DSL::Routing
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Grape
|
|
4
|
-
module DSL
|
|
5
|
-
module Configuration
|
|
6
|
-
extend ActiveSupport::Concern
|
|
7
|
-
|
|
8
|
-
module ClassMethods
|
|
9
|
-
include Grape::DSL::Settings
|
|
10
|
-
include Grape::DSL::Logger
|
|
11
|
-
include Grape::DSL::Desc
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Grape
|
|
4
|
-
module Extensions
|
|
5
|
-
module ActiveSupport
|
|
6
|
-
module HashWithIndifferentAccess
|
|
7
|
-
module ParamBuilder
|
|
8
|
-
extend ::ActiveSupport::Concern
|
|
9
|
-
|
|
10
|
-
included do
|
|
11
|
-
Grape.deprecator.warn 'This concern has been deprecated. Use `build_with` with one of the following short_name (:hash, :hash_with_indifferent_access, :hashie_mash) instead.'
|
|
12
|
-
namespace_inheritable(:build_params_with, :hash_with_indifferent_access)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def build_params
|
|
16
|
-
::ActiveSupport::HashWithIndifferentAccess.new(rack_params).tap do |params|
|
|
17
|
-
params.deep_merge!(grape_routing_args) if env.key?(Grape::Env::GRAPE_ROUTING_ARGS)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Grape
|
|
4
|
-
module Extensions
|
|
5
|
-
module Hash
|
|
6
|
-
module ParamBuilder
|
|
7
|
-
extend ::ActiveSupport::Concern
|
|
8
|
-
|
|
9
|
-
included do
|
|
10
|
-
Grape.deprecator.warn 'This concern has been deprecated. Use `build_with` with one of the following short_name (:hash, :hash_with_indifferent_access, :hashie_mash) instead.'
|
|
11
|
-
namespace_inheritable(:build_params_with, :hash)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def build_params
|
|
15
|
-
rack_params.deep_dup.tap do |params|
|
|
16
|
-
params.deep_symbolize_keys!
|
|
17
|
-
|
|
18
|
-
if env.key?(Grape::Env::GRAPE_ROUTING_ARGS)
|
|
19
|
-
grape_routing_args.deep_symbolize_keys!
|
|
20
|
-
params.deep_merge!(grape_routing_args)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Grape
|
|
4
|
-
module Extensions
|
|
5
|
-
module Hashie
|
|
6
|
-
module Mash
|
|
7
|
-
module ParamBuilder
|
|
8
|
-
extend ::ActiveSupport::Concern
|
|
9
|
-
|
|
10
|
-
included do
|
|
11
|
-
Grape.deprecator.warn 'This concern has been deprecated. Use `build_with` with one of the following short_name (:hash, :hash_with_indifferent_access, :hashie_mash) instead.'
|
|
12
|
-
namespace_inheritable(:build_params_with, :hashie_mash)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def build_params
|
|
16
|
-
::Hashie::Mash.new(rack_params).tap do |params|
|
|
17
|
-
params.deep_merge!(grape_routing_args) if env.key?(Grape::Env::GRAPE_ROUTING_ARGS)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Grape
|
|
4
|
-
module Middleware
|
|
5
|
-
class Globals < Base
|
|
6
|
-
def before
|
|
7
|
-
request = Grape::Request.new(@env, build_params_with: @options[:build_params_with])
|
|
8
|
-
@env[Grape::Env::GRAPE_REQUEST] = request
|
|
9
|
-
@env[Grape::Env::GRAPE_REQUEST_HEADERS] = request.headers
|
|
10
|
-
@env[Grape::Env::GRAPE_REQUEST_PARAMS] = request.params if @env[Rack::RACK_INPUT]
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Grape
|
|
4
|
-
module Util
|
|
5
|
-
# Base for classes which need to operate with own values kept
|
|
6
|
-
# in the hash and inherited values kept in a Hash-like object.
|
|
7
|
-
class BaseInheritable
|
|
8
|
-
attr_accessor :inherited_values, :new_values
|
|
9
|
-
|
|
10
|
-
# @param inherited_values [Object] An object implementing an interface
|
|
11
|
-
# of the Hash class.
|
|
12
|
-
def initialize(inherited_values = nil)
|
|
13
|
-
@inherited_values = inherited_values || {}
|
|
14
|
-
@new_values = {}
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def delete(key)
|
|
18
|
-
new_values.delete key
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def initialize_copy(other)
|
|
22
|
-
super
|
|
23
|
-
self.inherited_values = other.inherited_values
|
|
24
|
-
self.new_values = other.new_values.dup
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def keys
|
|
28
|
-
if new_values.any?
|
|
29
|
-
inherited_values.keys.tap do |combined|
|
|
30
|
-
combined.concat(new_values.keys)
|
|
31
|
-
combined.uniq!
|
|
32
|
-
end
|
|
33
|
-
else
|
|
34
|
-
inherited_values.keys
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def key?(name)
|
|
39
|
-
inherited_values.key?(name) || new_values.key?(name)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Grape
|
|
4
|
-
module Util
|
|
5
|
-
class InheritableValues < BaseInheritable
|
|
6
|
-
def [](name)
|
|
7
|
-
values[name]
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def []=(name, value)
|
|
11
|
-
new_values[name] = value
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def merge(new_hash)
|
|
15
|
-
values.merge!(new_hash)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def to_hash
|
|
19
|
-
values
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
protected
|
|
23
|
-
|
|
24
|
-
def values
|
|
25
|
-
@inherited_values.merge(@new_values)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Grape
|
|
4
|
-
module Util
|
|
5
|
-
class ReverseStackableValues < StackableValues
|
|
6
|
-
protected
|
|
7
|
-
|
|
8
|
-
def concat_values(inherited_value, new_value)
|
|
9
|
-
return inherited_value unless new_value
|
|
10
|
-
|
|
11
|
-
new_value + inherited_value
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|