grape 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/CONTRIBUTING.md +1 -1
- data/README.md +1 -1
- data/UPGRADING.md +4 -4
- data/lib/grape/util/json.rb +0 -2
- data/lib/grape/validations/types/array_coercer.rb +2 -0
- data/lib/grape/validations/types/build_coercer.rb +94 -0
- data/lib/grape/validations/types/dry_type_coercer.rb +10 -1
- data/lib/grape/validations/types/json.rb +2 -0
- data/lib/grape/validations/types/primitive_coercer.rb +7 -5
- data/lib/grape/validations/types/set_coercer.rb +3 -0
- data/lib/grape/validations/types.rb +9 -83
- data/lib/grape/validations/validators/{all_or_none_of_validator.rb → all_or_none.rb} +2 -0
- data/lib/grape/validations/validators/{allow_blank_validator.rb → allow_blank.rb} +0 -0
- data/lib/grape/validations/validators/{as_validator.rb → as.rb} +0 -0
- data/lib/grape/validations/validators/{at_least_one_of_validator.rb → at_least_one_of.rb} +2 -0
- data/lib/grape/validations/validators/{coerce_validator.rb → coerce.rb} +0 -0
- data/lib/grape/validations/validators/{default_validator.rb → default.rb} +0 -0
- data/lib/grape/validations/validators/{exactly_one_of_validator.rb → exactly_one_of.rb} +2 -0
- data/lib/grape/validations/validators/{except_values_validator.rb → except_values.rb} +0 -0
- data/lib/grape/validations/validators/{mutual_exclusion_validator.rb → mutual_exclusion.rb} +2 -0
- data/lib/grape/validations/validators/{presence_validator.rb → presence.rb} +0 -0
- data/lib/grape/validations/validators/{regexp_validator.rb → regexp.rb} +0 -0
- data/lib/grape/validations/validators/{same_as_validator.rb → same_as.rb} +0 -0
- data/lib/grape/validations/validators/{values_validator.rb → values.rb} +0 -0
- data/lib/grape/validations.rb +6 -0
- data/lib/grape/version.rb +1 -1
- data/lib/grape.rb +24 -57
- metadata +19 -19
- data/lib/grape/dry_types.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d182a6dfa2a571345d24a6a2b7286b4a2b34eeedc6570334ba2259fdda59faac
|
4
|
+
data.tar.gz: c365091e871e7ad78dd46dc0aab52cdd41d1e5ddb5a46503fcf0020af45f4324
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 539fdf761a5058dfcb3bab993a7fac3c7223ec06e0b828e102cb52095ac79f63668ebab1c1c4b47bf16984990c94f9a291537e7b2a1359626736b7abdd2c34ec
|
7
|
+
data.tar.gz: 2b30d941ab114aab53c4f4630742adedd037856ecc63b65f87b0df506349a13eed092964d9f53c003774006e74b9800043178b2ad2e6c55b0d5d42f6039a7e71
|
data/CHANGELOG.md
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -119,7 +119,7 @@ Go back to your pull request after a few minutes and see whether it passed muste
|
|
119
119
|
|
120
120
|
#### Be Patient
|
121
121
|
|
122
|
-
It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang
|
122
|
+
It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang in there!
|
123
123
|
|
124
124
|
#### Thank You
|
125
125
|
|
data/README.md
CHANGED
@@ -158,7 +158,7 @@ content negotiation, versioning and much more.
|
|
158
158
|
|
159
159
|
## Stable Release
|
160
160
|
|
161
|
-
You're reading the documentation for the stable release of Grape, **1.6.
|
161
|
+
You're reading the documentation for the stable release of Grape, **1.6.2**.
|
162
162
|
Please read [UPGRADING](UPGRADING.md) when upgrading from a previous version.
|
163
163
|
|
164
164
|
## Project Resources
|
data/UPGRADING.md
CHANGED
@@ -27,7 +27,7 @@ declared(params, include_missing: false)
|
|
27
27
|
# actual => { b: '5' } (uncasted, unvalidated, <= 1.5.3)
|
28
28
|
```
|
29
29
|
|
30
|
-
Another implication of this change is the dependent parameter resolution. Prior to 1.6.0 the following code produced
|
30
|
+
Another implication of this change is the dependent parameter resolution. Prior to 1.6.0 the following code produced a `Grape::Exceptions::UnknownParameter` because `:a` was replaced by `:b`:
|
31
31
|
|
32
32
|
```ruby
|
33
33
|
params do
|
@@ -47,7 +47,7 @@ See [#2189](https://github.com/ruby-grape/grape/pull/2189) for more information.
|
|
47
47
|
#### Nil value and coercion
|
48
48
|
|
49
49
|
Prior to 1.2.5 version passing a `nil` value for a parameter with a custom coercer would invoke the coercer, and not passing a parameter would not invoke it.
|
50
|
-
This behavior was not tested or documented. Version 1.3.0 quietly changed this behavior, in
|
50
|
+
This behavior was not tested or documented. Version 1.3.0 quietly changed this behavior, in that `nil` values skipped the coercion. Version 1.5.3 fixes and documents this as follows:
|
51
51
|
|
52
52
|
```ruby
|
53
53
|
class Api < Grape::API
|
@@ -197,13 +197,13 @@ end
|
|
197
197
|
|
198
198
|
#### Nil values for structures
|
199
199
|
|
200
|
-
Nil values always been a special case when dealing with types especially with the following structures:
|
200
|
+
Nil values have always been a special case when dealing with types, especially with the following structures:
|
201
201
|
|
202
202
|
- Array
|
203
203
|
- Hash
|
204
204
|
- Set
|
205
205
|
|
206
|
-
The behavior for these structures has
|
206
|
+
The behavior for these structures has changed throughout the latest releases. For example:
|
207
207
|
|
208
208
|
```ruby
|
209
209
|
class Api < Grape::API
|
data/lib/grape/util/json.rb
CHANGED
@@ -0,0 +1,94 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'array_coercer'
|
4
|
+
require_relative 'set_coercer'
|
5
|
+
require_relative 'primitive_coercer'
|
6
|
+
|
7
|
+
module Grape
|
8
|
+
module Validations
|
9
|
+
module Types
|
10
|
+
# Chooses the best coercer for the given type. For example, if the type
|
11
|
+
# is Integer, it will return a coercer which will be able to coerce a value
|
12
|
+
# to the integer.
|
13
|
+
#
|
14
|
+
# There are a few very special coercers which might be returned.
|
15
|
+
#
|
16
|
+
# +Grape::Types::MultipleTypeCoercer+ is a coercer which is returned when
|
17
|
+
# the given type implies values in an array with different types.
|
18
|
+
# For example, +[Integer, String]+ allows integer and string values in
|
19
|
+
# an array.
|
20
|
+
#
|
21
|
+
# +Grape::Types::CustomTypeCoercer+ is a coercer which is returned when
|
22
|
+
# a method is specified by a user with +coerce_with+ option or the user
|
23
|
+
# specifies a custom type which implements requirments of
|
24
|
+
# +Grape::Types::CustomTypeCoercer+.
|
25
|
+
#
|
26
|
+
# +Grape::Types::CustomTypeCollectionCoercer+ is a very similar to the
|
27
|
+
# previous one, but it expects an array or set of values having a custom
|
28
|
+
# type implemented by the user.
|
29
|
+
#
|
30
|
+
# There is also a group of custom types implemented by Grape, check
|
31
|
+
# +Grape::Validations::Types::SPECIAL+ to get the full list.
|
32
|
+
#
|
33
|
+
# @param type [Class] the type to which input strings
|
34
|
+
# should be coerced
|
35
|
+
# @param method [Class,#call] the coercion method to use
|
36
|
+
# @return [Object] object to be used
|
37
|
+
# for coercion and type validation
|
38
|
+
def self.build_coercer(type, method: nil, strict: false)
|
39
|
+
cache_instance(type, method, strict) do
|
40
|
+
create_coercer_instance(type, method, strict)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.create_coercer_instance(type, method, strict)
|
45
|
+
# Maps a custom type provided by Grape, it doesn't map types wrapped by collections!!!
|
46
|
+
type = Types.map_special(type)
|
47
|
+
|
48
|
+
# Use a special coercer for multiply-typed parameters.
|
49
|
+
if Types.multiple?(type)
|
50
|
+
MultipleTypeCoercer.new(type, method)
|
51
|
+
|
52
|
+
# Use a special coercer for custom types and coercion methods.
|
53
|
+
elsif method || Types.custom?(type)
|
54
|
+
CustomTypeCoercer.new(type, method)
|
55
|
+
|
56
|
+
# Special coercer for collections of types that implement a parse method.
|
57
|
+
# CustomTypeCoercer (above) already handles such types when an explicit coercion
|
58
|
+
# method is supplied.
|
59
|
+
elsif Types.collection_of_custom?(type)
|
60
|
+
Types::CustomTypeCollectionCoercer.new(
|
61
|
+
Types.map_special(type.first), type.is_a?(Set)
|
62
|
+
)
|
63
|
+
else
|
64
|
+
DryTypeCoercer.coercer_instance_for(type, strict)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.cache_instance(type, method, strict, &_block)
|
69
|
+
key = cache_key(type, method, strict)
|
70
|
+
|
71
|
+
return @__cache[key] if @__cache.key?(key)
|
72
|
+
|
73
|
+
instance = yield
|
74
|
+
|
75
|
+
@__cache_write_lock.synchronize do
|
76
|
+
@__cache[key] = instance
|
77
|
+
end
|
78
|
+
|
79
|
+
instance
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.cache_key(type, method, strict)
|
83
|
+
[type, method, strict].each_with_object(+'_') do |val, memo|
|
84
|
+
next if val.nil?
|
85
|
+
|
86
|
+
memo << '_' << val.to_s
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
instance_variable_set(:@__cache, {})
|
91
|
+
instance_variable_set(:@__cache_write_lock, Mutex.new)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -1,5 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'dry-types'
|
4
|
+
|
5
|
+
module DryTypes
|
6
|
+
# Call +Dry.Types()+ to add all registered types to +DryTypes+ which is
|
7
|
+
# a container in this case. Check documentation for more information
|
8
|
+
# https://dry-rb.org/gems/dry-types/1.2/getting-started/
|
9
|
+
include Dry.Types()
|
10
|
+
end
|
11
|
+
|
3
12
|
module Grape
|
4
13
|
module Validations
|
5
14
|
module Types
|
@@ -43,7 +52,7 @@ module Grape
|
|
43
52
|
def initialize(type, strict = false)
|
44
53
|
@type = type
|
45
54
|
@strict = strict
|
46
|
-
@scope = strict ?
|
55
|
+
@scope = strict ? DryTypes::Strict : DryTypes::Params
|
47
56
|
end
|
48
57
|
|
49
58
|
# Coerces the given value to a type which was specified during
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'dry_type_coercer'
|
4
|
+
|
3
5
|
module Grape
|
4
6
|
module Validations
|
5
7
|
module Types
|
@@ -8,16 +10,16 @@ module Grape
|
|
8
10
|
# that it has the proper type.
|
9
11
|
class PrimitiveCoercer < DryTypeCoercer
|
10
12
|
MAPPING = {
|
11
|
-
Grape::API::Boolean =>
|
12
|
-
BigDecimal =>
|
13
|
+
Grape::API::Boolean => DryTypes::Params::Bool,
|
14
|
+
BigDecimal => DryTypes::Params::Decimal,
|
13
15
|
|
14
16
|
# unfortunately, a +Params+ scope doesn't contain String
|
15
|
-
String =>
|
17
|
+
String => DryTypes::Coercible::String
|
16
18
|
}.freeze
|
17
19
|
|
18
20
|
STRICT_MAPPING = {
|
19
|
-
Grape::API::Boolean =>
|
20
|
-
BigDecimal =>
|
21
|
+
Grape::API::Boolean => DryTypes::Strict::Bool,
|
22
|
+
BigDecimal => DryTypes::Strict::Decimal
|
21
23
|
}.freeze
|
22
24
|
|
23
25
|
def initialize(type, strict = false)
|
@@ -1,5 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'types/build_coercer'
|
4
|
+
require_relative 'types/custom_type_coercer'
|
5
|
+
require_relative 'types/custom_type_collection_coercer'
|
6
|
+
require_relative 'types/multiple_type_coercer'
|
7
|
+
require_relative 'types/variant_collection_coercer'
|
8
|
+
require_relative 'types/json'
|
9
|
+
require_relative 'types/file'
|
10
|
+
require_relative 'types/invalid_value'
|
11
|
+
|
3
12
|
module Grape
|
4
13
|
module Validations
|
5
14
|
# Module for code related to grape's system for
|
@@ -134,89 +143,6 @@ module Grape
|
|
134
143
|
def self.map_special(type)
|
135
144
|
SPECIAL.fetch(type, type)
|
136
145
|
end
|
137
|
-
|
138
|
-
# Chooses the best coercer for the given type. For example, if the type
|
139
|
-
# is Integer, it will return a coercer which will be able to coerce a value
|
140
|
-
# to the integer.
|
141
|
-
#
|
142
|
-
# There are a few very special coercers which might be returned.
|
143
|
-
#
|
144
|
-
# +Grape::Types::MultipleTypeCoercer+ is a coercer which is returned when
|
145
|
-
# the given type implies values in an array with different types.
|
146
|
-
# For example, +[Integer, String]+ allows integer and string values in
|
147
|
-
# an array.
|
148
|
-
#
|
149
|
-
# +Grape::Types::CustomTypeCoercer+ is a coercer which is returned when
|
150
|
-
# a method is specified by a user with +coerce_with+ option or the user
|
151
|
-
# specifies a custom type which implements requirments of
|
152
|
-
# +Grape::Types::CustomTypeCoercer+.
|
153
|
-
#
|
154
|
-
# +Grape::Types::CustomTypeCollectionCoercer+ is a very similar to the
|
155
|
-
# previous one, but it expects an array or set of values having a custom
|
156
|
-
# type implemented by the user.
|
157
|
-
#
|
158
|
-
# There is also a group of custom types implemented by Grape, check
|
159
|
-
# +Grape::Validations::Types::SPECIAL+ to get the full list.
|
160
|
-
#
|
161
|
-
# @param type [Class] the type to which input strings
|
162
|
-
# should be coerced
|
163
|
-
# @param method [Class,#call] the coercion method to use
|
164
|
-
# @return [Object] object to be used
|
165
|
-
# for coercion and type validation
|
166
|
-
def self.build_coercer(type, method: nil, strict: false)
|
167
|
-
cache_instance(type, method, strict) do
|
168
|
-
create_coercer_instance(type, method, strict)
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
def self.create_coercer_instance(type, method, strict)
|
173
|
-
# Maps a custom type provided by Grape, it doesn't map types wrapped by collections!!!
|
174
|
-
type = Types.map_special(type)
|
175
|
-
|
176
|
-
# Use a special coercer for multiply-typed parameters.
|
177
|
-
if Types.multiple?(type)
|
178
|
-
MultipleTypeCoercer.new(type, method)
|
179
|
-
|
180
|
-
# Use a special coercer for custom types and coercion methods.
|
181
|
-
elsif method || Types.custom?(type)
|
182
|
-
CustomTypeCoercer.new(type, method)
|
183
|
-
|
184
|
-
# Special coercer for collections of types that implement a parse method.
|
185
|
-
# CustomTypeCoercer (above) already handles such types when an explicit coercion
|
186
|
-
# method is supplied.
|
187
|
-
elsif Types.collection_of_custom?(type)
|
188
|
-
Types::CustomTypeCollectionCoercer.new(
|
189
|
-
Types.map_special(type.first), type.is_a?(Set)
|
190
|
-
)
|
191
|
-
else
|
192
|
-
DryTypeCoercer.coercer_instance_for(type, strict)
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
def self.cache_instance(type, method, strict, &_block)
|
197
|
-
key = cache_key(type, method, strict)
|
198
|
-
|
199
|
-
return @__cache[key] if @__cache.key?(key)
|
200
|
-
|
201
|
-
instance = yield
|
202
|
-
|
203
|
-
@__cache_write_lock.synchronize do
|
204
|
-
@__cache[key] = instance
|
205
|
-
end
|
206
|
-
|
207
|
-
instance
|
208
|
-
end
|
209
|
-
|
210
|
-
def self.cache_key(type, method, strict)
|
211
|
-
[type, method, strict].each_with_object(+'_') do |val, memo|
|
212
|
-
next if val.nil?
|
213
|
-
|
214
|
-
memo << '_' << val.to_s
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
instance_variable_set(:@__cache, {})
|
219
|
-
instance_variable_set(:@__cache_write_lock, Mutex.new)
|
220
146
|
end
|
221
147
|
end
|
222
148
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/grape/validations.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'grape/validations/attributes_iterator'
|
4
|
+
require 'grape/validations/single_attribute_iterator'
|
5
|
+
require 'grape/validations/multiple_attributes_iterator'
|
6
|
+
require 'grape/validations/params_scope'
|
7
|
+
require 'grape/validations/types'
|
8
|
+
|
3
9
|
module Grape
|
4
10
|
# Registry to store and locate known Validators.
|
5
11
|
module Validations
|
data/lib/grape/version.rb
CHANGED
data/lib/grape.rb
CHANGED
@@ -12,14 +12,14 @@ require 'active_support/version'
|
|
12
12
|
require 'active_support/isolated_execution_state' if ActiveSupport::VERSION::MAJOR > 6
|
13
13
|
require 'active_support/core_ext/hash/indifferent_access'
|
14
14
|
require 'active_support/core_ext/object/blank'
|
15
|
-
require 'active_support/core_ext/array/conversions'
|
16
15
|
require 'active_support/core_ext/array/extract_options'
|
17
16
|
require 'active_support/core_ext/array/wrap'
|
18
|
-
require 'active_support/core_ext/
|
17
|
+
require 'active_support/core_ext/array/conversions'
|
19
18
|
require 'active_support/core_ext/hash/deep_merge'
|
20
|
-
require 'active_support/core_ext/hash/except'
|
21
19
|
require 'active_support/core_ext/hash/reverse_merge'
|
20
|
+
require 'active_support/core_ext/hash/except'
|
22
21
|
require 'active_support/core_ext/hash/slice'
|
22
|
+
require 'active_support/core_ext/hash/conversions'
|
23
23
|
require 'active_support/dependencies/autoload'
|
24
24
|
require 'active_support/notifications'
|
25
25
|
require 'i18n'
|
@@ -45,7 +45,6 @@ module Grape
|
|
45
45
|
autoload :Env, 'grape/util/env'
|
46
46
|
autoload :Json, 'grape/util/json'
|
47
47
|
autoload :Xml, 'grape/util/xml'
|
48
|
-
autoload :DryTypes
|
49
48
|
end
|
50
49
|
|
51
50
|
module Http
|
@@ -219,59 +218,6 @@ module Grape
|
|
219
218
|
autoload :StreamResponse
|
220
219
|
end
|
221
220
|
end
|
222
|
-
|
223
|
-
module Validations
|
224
|
-
extend ::ActiveSupport::Autoload
|
225
|
-
|
226
|
-
module Types
|
227
|
-
extend ::ActiveSupport::Autoload
|
228
|
-
|
229
|
-
eager_autoload do
|
230
|
-
autoload :InvalidValue
|
231
|
-
autoload :File
|
232
|
-
autoload :Json
|
233
|
-
autoload :DryTypeCoercer
|
234
|
-
autoload :ArrayCoercer
|
235
|
-
autoload :SetCoercer
|
236
|
-
autoload :PrimitiveCoercer
|
237
|
-
autoload :CustomTypeCoercer
|
238
|
-
autoload :CustomTypeCollectionCoercer
|
239
|
-
autoload :MultipleTypeCoercer
|
240
|
-
autoload :VariantCollectionCoercer
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
eager_autoload do
|
245
|
-
autoload :AttributesIterator
|
246
|
-
autoload :MultipleAttributesIterator
|
247
|
-
autoload :SingleAttributeIterator
|
248
|
-
autoload :ParamsScope
|
249
|
-
autoload :Types
|
250
|
-
autoload :ValidatorFactory
|
251
|
-
end
|
252
|
-
|
253
|
-
module Validators
|
254
|
-
extend ::ActiveSupport::Autoload
|
255
|
-
|
256
|
-
eager_autoload do
|
257
|
-
autoload :Base
|
258
|
-
autoload :MultipleParamsBase
|
259
|
-
autoload :AllOrNoneOfValidator
|
260
|
-
autoload :AllowBlankValidator
|
261
|
-
autoload :AsValidator
|
262
|
-
autoload :AtLeastOneOfValidator
|
263
|
-
autoload :CoerceValidator
|
264
|
-
autoload :DefaultValidator
|
265
|
-
autoload :ExactlyOneOfValidator
|
266
|
-
autoload :ExceptValuesValidator
|
267
|
-
autoload :MutualExclusionValidator
|
268
|
-
autoload :PresenceValidator
|
269
|
-
autoload :RegexpValidator
|
270
|
-
autoload :SameAsValidator
|
271
|
-
autoload :ValuesValidator
|
272
|
-
end
|
273
|
-
end
|
274
|
-
end
|
275
221
|
end
|
276
222
|
|
277
223
|
require 'grape/config'
|
@@ -281,4 +227,25 @@ require 'grape/util/lazy_value'
|
|
281
227
|
require 'grape/util/lazy_block'
|
282
228
|
require 'grape/util/endpoint_configuration'
|
283
229
|
|
230
|
+
require 'grape/validations/validators/base'
|
231
|
+
require 'grape/validations/attributes_iterator'
|
232
|
+
require 'grape/validations/single_attribute_iterator'
|
233
|
+
require 'grape/validations/multiple_attributes_iterator'
|
234
|
+
require 'grape/validations/validators/allow_blank'
|
235
|
+
require 'grape/validations/validators/as'
|
236
|
+
require 'grape/validations/validators/at_least_one_of'
|
237
|
+
require 'grape/validations/validators/coerce'
|
238
|
+
require 'grape/validations/validators/default'
|
239
|
+
require 'grape/validations/validators/exactly_one_of'
|
240
|
+
require 'grape/validations/validators/mutual_exclusion'
|
241
|
+
require 'grape/validations/validators/presence'
|
242
|
+
require 'grape/validations/validators/regexp'
|
243
|
+
require 'grape/validations/validators/same_as'
|
244
|
+
require 'grape/validations/validators/values'
|
245
|
+
require 'grape/validations/validators/except_values'
|
246
|
+
require 'grape/validations/params_scope'
|
247
|
+
require 'grape/validations/validators/all_or_none'
|
248
|
+
require 'grape/validations/types'
|
249
|
+
require 'grape/validations/validator_factory'
|
250
|
+
|
284
251
|
require 'grape/version'
|
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.
|
4
|
+
version: 1.6.2
|
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-
|
11
|
+
date: 2021-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -115,7 +115,6 @@ files:
|
|
115
115
|
- lib/grape/config.rb
|
116
116
|
- lib/grape/content_types.rb
|
117
117
|
- lib/grape/cookies.rb
|
118
|
-
- lib/grape/dry_types.rb
|
119
118
|
- lib/grape/dsl/api.rb
|
120
119
|
- lib/grape/dsl/callbacks.rb
|
121
120
|
- lib/grape/dsl/configuration.rb
|
@@ -224,6 +223,7 @@ files:
|
|
224
223
|
- lib/grape/validations/single_attribute_iterator.rb
|
225
224
|
- lib/grape/validations/types.rb
|
226
225
|
- lib/grape/validations/types/array_coercer.rb
|
226
|
+
- lib/grape/validations/types/build_coercer.rb
|
227
227
|
- lib/grape/validations/types/custom_type_coercer.rb
|
228
228
|
- lib/grape/validations/types/custom_type_collection_coercer.rb
|
229
229
|
- lib/grape/validations/types/dry_type_coercer.rb
|
@@ -235,21 +235,21 @@ files:
|
|
235
235
|
- lib/grape/validations/types/set_coercer.rb
|
236
236
|
- lib/grape/validations/types/variant_collection_coercer.rb
|
237
237
|
- lib/grape/validations/validator_factory.rb
|
238
|
-
- lib/grape/validations/validators/
|
239
|
-
- lib/grape/validations/validators/
|
240
|
-
- lib/grape/validations/validators/
|
241
|
-
- lib/grape/validations/validators/
|
238
|
+
- lib/grape/validations/validators/all_or_none.rb
|
239
|
+
- lib/grape/validations/validators/allow_blank.rb
|
240
|
+
- lib/grape/validations/validators/as.rb
|
241
|
+
- lib/grape/validations/validators/at_least_one_of.rb
|
242
242
|
- lib/grape/validations/validators/base.rb
|
243
|
-
- lib/grape/validations/validators/
|
244
|
-
- lib/grape/validations/validators/
|
245
|
-
- lib/grape/validations/validators/
|
246
|
-
- lib/grape/validations/validators/
|
243
|
+
- lib/grape/validations/validators/coerce.rb
|
244
|
+
- lib/grape/validations/validators/default.rb
|
245
|
+
- lib/grape/validations/validators/exactly_one_of.rb
|
246
|
+
- lib/grape/validations/validators/except_values.rb
|
247
247
|
- lib/grape/validations/validators/multiple_params_base.rb
|
248
|
-
- lib/grape/validations/validators/
|
249
|
-
- lib/grape/validations/validators/
|
250
|
-
- lib/grape/validations/validators/
|
251
|
-
- lib/grape/validations/validators/
|
252
|
-
- lib/grape/validations/validators/
|
248
|
+
- lib/grape/validations/validators/mutual_exclusion.rb
|
249
|
+
- lib/grape/validations/validators/presence.rb
|
250
|
+
- lib/grape/validations/validators/regexp.rb
|
251
|
+
- lib/grape/validations/validators/same_as.rb
|
252
|
+
- lib/grape/validations/validators/values.rb
|
253
253
|
- lib/grape/version.rb
|
254
254
|
- spec/grape/api/custom_validations_spec.rb
|
255
255
|
- spec/grape/api/deeply_included_options_spec.rb
|
@@ -371,9 +371,9 @@ licenses:
|
|
371
371
|
- MIT
|
372
372
|
metadata:
|
373
373
|
bug_tracker_uri: https://github.com/ruby-grape/grape/issues
|
374
|
-
changelog_uri: https://github.com/ruby-grape/grape/blob/v1.6.
|
375
|
-
documentation_uri: https://www.rubydoc.info/gems/grape/1.6.
|
376
|
-
source_code_uri: https://github.com/ruby-grape/grape/tree/v1.6.
|
374
|
+
changelog_uri: https://github.com/ruby-grape/grape/blob/v1.6.2/CHANGELOG.md
|
375
|
+
documentation_uri: https://www.rubydoc.info/gems/grape/1.6.2
|
376
|
+
source_code_uri: https://github.com/ruby-grape/grape/tree/v1.6.2
|
377
377
|
post_install_message:
|
378
378
|
rdoc_options: []
|
379
379
|
require_paths:
|
data/lib/grape/dry_types.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'dry-types'
|
4
|
-
|
5
|
-
module Grape
|
6
|
-
module DryTypes
|
7
|
-
# Call +Dry.Types()+ to add all registered types to +DryTypes+ which is
|
8
|
-
# a container in this case. Check documentation for more information
|
9
|
-
# https://dry-rb.org/gems/dry-types/1.2/getting-started/
|
10
|
-
include Dry.Types()
|
11
|
-
end
|
12
|
-
end
|