grape 2.0.0 → 2.2.0
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 +96 -1
- data/README.md +364 -317
- data/UPGRADING.md +205 -7
- data/grape.gemspec +7 -7
- data/lib/grape/api/instance.rb +14 -11
- data/lib/grape/api.rb +19 -10
- data/lib/grape/content_types.rb +13 -10
- data/lib/grape/cookies.rb +2 -1
- data/lib/grape/dry_types.rb +0 -2
- data/lib/grape/dsl/desc.rb +22 -20
- data/lib/grape/dsl/headers.rb +1 -1
- data/lib/grape/dsl/helpers.rb +7 -3
- data/lib/grape/dsl/inside_route.rb +51 -15
- data/lib/grape/dsl/parameters.rb +5 -4
- data/lib/grape/dsl/request_response.rb +14 -18
- data/lib/grape/dsl/routing.rb +20 -4
- data/lib/grape/dsl/validations.rb +13 -0
- data/lib/grape/endpoint.rb +43 -35
- data/lib/grape/{util/env.rb → env.rb} +0 -5
- data/lib/grape/error_formatter/json.rb +13 -4
- data/lib/grape/error_formatter/txt.rb +11 -10
- data/lib/grape/error_formatter.rb +13 -25
- data/lib/grape/exceptions/base.rb +3 -3
- data/lib/grape/exceptions/validation.rb +0 -2
- data/lib/grape/exceptions/validation_array_errors.rb +1 -0
- data/lib/grape/exceptions/validation_errors.rb +2 -4
- data/lib/grape/extensions/hash.rb +5 -1
- data/lib/grape/formatter.rb +15 -25
- data/lib/grape/http/headers.rb +18 -34
- data/lib/grape/{util/json.rb → json.rb} +1 -3
- data/lib/grape/locale/en.yml +4 -0
- data/lib/grape/middleware/auth/base.rb +0 -2
- data/lib/grape/middleware/auth/dsl.rb +0 -2
- data/lib/grape/middleware/base.rb +14 -15
- data/lib/grape/middleware/error.rb +61 -54
- data/lib/grape/middleware/formatter.rb +18 -15
- data/lib/grape/middleware/globals.rb +1 -3
- data/lib/grape/middleware/stack.rb +4 -5
- data/lib/grape/middleware/versioner/accept_version_header.rb +8 -33
- data/lib/grape/middleware/versioner/header.rb +62 -123
- data/lib/grape/middleware/versioner/param.rb +5 -23
- data/lib/grape/middleware/versioner/path.rb +11 -33
- data/lib/grape/middleware/versioner.rb +5 -14
- data/lib/grape/middleware/versioner_helpers.rb +75 -0
- data/lib/grape/namespace.rb +3 -4
- data/lib/grape/parser.rb +8 -24
- data/lib/grape/path.rb +24 -29
- data/lib/grape/request.rb +4 -12
- data/lib/grape/router/base_route.rb +39 -0
- data/lib/grape/router/greedy_route.rb +20 -0
- data/lib/grape/router/pattern.rb +39 -30
- data/lib/grape/router/route.rb +22 -59
- data/lib/grape/router.rb +32 -37
- data/lib/grape/util/base_inheritable.rb +4 -4
- data/lib/grape/util/cache.rb +0 -3
- data/lib/grape/util/endpoint_configuration.rb +1 -1
- data/lib/grape/util/header.rb +13 -0
- data/lib/grape/util/inheritable_values.rb +0 -2
- data/lib/grape/util/lazy/block.rb +29 -0
- data/lib/grape/util/lazy/object.rb +45 -0
- data/lib/grape/util/lazy/value.rb +38 -0
- data/lib/grape/util/lazy/value_array.rb +21 -0
- data/lib/grape/util/lazy/value_enumerable.rb +34 -0
- data/lib/grape/util/lazy/value_hash.rb +21 -0
- data/lib/grape/util/media_type.rb +70 -0
- data/lib/grape/util/reverse_stackable_values.rb +1 -6
- data/lib/grape/util/stackable_values.rb +1 -6
- data/lib/grape/util/strict_hash_configuration.rb +3 -3
- data/lib/grape/validations/attributes_doc.rb +38 -36
- data/lib/grape/validations/attributes_iterator.rb +1 -0
- data/lib/grape/validations/contract_scope.rb +71 -0
- data/lib/grape/validations/params_scope.rb +22 -19
- data/lib/grape/validations/types/array_coercer.rb +0 -2
- data/lib/grape/validations/types/build_coercer.rb +69 -71
- data/lib/grape/validations/types/dry_type_coercer.rb +1 -11
- data/lib/grape/validations/types/json.rb +0 -2
- data/lib/grape/validations/types/primitive_coercer.rb +0 -2
- data/lib/grape/validations/types/set_coercer.rb +0 -3
- data/lib/grape/validations/types.rb +0 -3
- data/lib/grape/validations/validators/base.rb +1 -0
- data/lib/grape/validations/validators/default_validator.rb +5 -1
- data/lib/grape/validations/validators/exactly_one_of_validator.rb +1 -1
- data/lib/grape/validations/validators/length_validator.rb +49 -0
- data/lib/grape/validations/validators/values_validator.rb +6 -1
- data/lib/grape/validations.rb +3 -7
- data/lib/grape/version.rb +1 -1
- data/lib/grape/{util/xml.rb → xml.rb} +1 -1
- data/lib/grape.rb +30 -274
- metadata +31 -38
- data/lib/grape/eager_load.rb +0 -20
- data/lib/grape/middleware/versioner/parse_media_type_patch.rb +0 -24
- data/lib/grape/router/attribute_translator.rb +0 -63
- data/lib/grape/util/lazy_block.rb +0 -27
- data/lib/grape/util/lazy_object.rb +0 -43
- data/lib/grape/util/lazy_value.rb +0 -91
- data/lib/grape/util/registrable.rb +0 -15
@@ -11,7 +11,11 @@ module Grape
|
|
11
11
|
|
12
12
|
def validate_param!(attr_name, params)
|
13
13
|
params[attr_name] = if @default.is_a? Proc
|
14
|
-
@default.
|
14
|
+
if @default.parameters.empty?
|
15
|
+
@default.call
|
16
|
+
else
|
17
|
+
@default.call(params)
|
18
|
+
end
|
15
19
|
elsif @default.frozen? || !@default.duplicable?
|
16
20
|
@default
|
17
21
|
else
|
@@ -7,7 +7,7 @@ module Grape
|
|
7
7
|
def validate_params!(params)
|
8
8
|
keys = keys_in_common(params)
|
9
9
|
return if keys.length == 1
|
10
|
-
raise Grape::Exceptions::Validation.new(params: all_keys, message: message(:exactly_one)) if keys.
|
10
|
+
raise Grape::Exceptions::Validation.new(params: all_keys, message: message(:exactly_one)) if keys.empty?
|
11
11
|
|
12
12
|
raise Grape::Exceptions::Validation.new(params: keys, message: message(:mutual_exclusion))
|
13
13
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Grape
|
4
|
+
module Validations
|
5
|
+
module Validators
|
6
|
+
class LengthValidator < Base
|
7
|
+
def initialize(attrs, options, required, scope, **opts)
|
8
|
+
@min = options[:min]
|
9
|
+
@max = options[:max]
|
10
|
+
@is = options[:is]
|
11
|
+
|
12
|
+
super
|
13
|
+
|
14
|
+
raise ArgumentError, 'min must be an integer greater than or equal to zero' if !@min.nil? && (!@min.is_a?(Integer) || @min.negative?)
|
15
|
+
raise ArgumentError, 'max must be an integer greater than or equal to zero' if !@max.nil? && (!@max.is_a?(Integer) || @max.negative?)
|
16
|
+
raise ArgumentError, "min #{@min} cannot be greater than max #{@max}" if !@min.nil? && !@max.nil? && @min > @max
|
17
|
+
|
18
|
+
return if @is.nil?
|
19
|
+
raise ArgumentError, 'is must be an integer greater than zero' if !@is.is_a?(Integer) || !@is.positive?
|
20
|
+
raise ArgumentError, 'is cannot be combined with min or max' if !@min.nil? || !@max.nil?
|
21
|
+
end
|
22
|
+
|
23
|
+
def validate_param!(attr_name, params)
|
24
|
+
param = params[attr_name]
|
25
|
+
|
26
|
+
return unless param.respond_to?(:length)
|
27
|
+
|
28
|
+
return unless (!@min.nil? && param.length < @min) || (!@max.nil? && param.length > @max) || (!@is.nil? && param.length != @is)
|
29
|
+
|
30
|
+
raise Grape::Exceptions::Validation.new(params: [@scope.full_name(attr_name)], message: build_message)
|
31
|
+
end
|
32
|
+
|
33
|
+
def build_message
|
34
|
+
if options_key?(:message)
|
35
|
+
@option[:message]
|
36
|
+
elsif @min && @max
|
37
|
+
format I18n.t(:length, scope: 'grape.errors.messages'), min: @min, max: @max
|
38
|
+
elsif @min
|
39
|
+
format I18n.t(:length_min, scope: 'grape.errors.messages'), min: @min
|
40
|
+
elsif @max
|
41
|
+
format I18n.t(:length_max, scope: 'grape.errors.messages'), max: @max
|
42
|
+
else
|
43
|
+
format I18n.t(:length_is, scope: 'grape.errors.messages'), is: @is
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -85,7 +85,12 @@ module Grape
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def required_for_root_scope?
|
88
|
-
|
88
|
+
return false unless @required
|
89
|
+
|
90
|
+
scope = @scope
|
91
|
+
scope = scope.parent while scope.lateral?
|
92
|
+
|
93
|
+
scope.root?
|
89
94
|
end
|
90
95
|
|
91
96
|
def validation_exception(attr_name, message)
|
data/lib/grape/validations.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Grape
|
4
|
-
# Registry to store and locate known Validators.
|
5
4
|
module Validations
|
6
5
|
module_function
|
7
6
|
|
@@ -12,7 +11,7 @@ module Grape
|
|
12
11
|
# Register a new validator, so it can be used to validate parameters.
|
13
12
|
# @param short_name [String] all lower-case, no spaces
|
14
13
|
# @param klass [Class] the validator class. Should inherit from
|
15
|
-
# Validations::Base.
|
14
|
+
# Grape::Validations::Validators::Base.
|
16
15
|
def register_validator(short_name, klass)
|
17
16
|
validators[short_name] = klass
|
18
17
|
end
|
@@ -21,14 +20,11 @@ module Grape
|
|
21
20
|
validators.delete(short_name)
|
22
21
|
end
|
23
22
|
|
24
|
-
# Find a validator and if not found will try to load it
|
25
23
|
def require_validator(short_name)
|
26
24
|
str_name = short_name.to_s
|
27
|
-
validators.fetch(str_name)
|
28
|
-
Grape::Validations::Validators.const_get("#{str_name.camelize}Validator")
|
29
|
-
end
|
25
|
+
validators.fetch(str_name) { Grape::Validations::Validators.const_get(:"#{str_name.camelize}Validator") }
|
30
26
|
rescue NameError
|
31
|
-
raise Grape::Exceptions::UnknownValidator
|
27
|
+
raise Grape::Exceptions::UnknownValidator, short_name
|
32
28
|
end
|
33
29
|
end
|
34
30
|
end
|
data/lib/grape/version.rb
CHANGED
data/lib/grape.rb
CHANGED
@@ -1,13 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'logger'
|
4
|
-
require 'rack'
|
5
|
-
require 'rack/builder'
|
6
|
-
require 'rack/accept'
|
7
|
-
require 'rack/auth/basic'
|
8
|
-
require 'set'
|
9
|
-
require 'bigdecimal'
|
10
|
-
require 'date'
|
11
3
|
require 'active_support'
|
12
4
|
require 'active_support/concern'
|
13
5
|
require 'active_support/configurable'
|
@@ -24,295 +16,59 @@ require 'active_support/core_ext/hash/indifferent_access'
|
|
24
16
|
require 'active_support/core_ext/hash/keys'
|
25
17
|
require 'active_support/core_ext/hash/reverse_merge'
|
26
18
|
require 'active_support/core_ext/hash/slice'
|
19
|
+
require 'active_support/core_ext/module/delegation'
|
27
20
|
require 'active_support/core_ext/object/blank'
|
28
21
|
require 'active_support/core_ext/object/deep_dup'
|
29
22
|
require 'active_support/core_ext/object/duplicable'
|
23
|
+
require 'active_support/core_ext/string/output_safety'
|
30
24
|
require 'active_support/core_ext/string/exclude'
|
31
|
-
require 'active_support/dependencies/autoload'
|
32
25
|
require 'active_support/deprecation'
|
33
26
|
require 'active_support/inflector'
|
27
|
+
require 'active_support/ordered_options'
|
34
28
|
require 'active_support/notifications'
|
35
|
-
|
29
|
+
|
30
|
+
require 'English'
|
31
|
+
require 'bigdecimal'
|
32
|
+
require 'date'
|
33
|
+
require 'dry-types'
|
34
|
+
require 'forwardable'
|
35
|
+
require 'json'
|
36
|
+
require 'logger'
|
37
|
+
require 'mustermann/grape'
|
38
|
+
require 'pathname'
|
39
|
+
require 'rack'
|
40
|
+
require 'rack/auth/basic'
|
41
|
+
require 'rack/builder'
|
42
|
+
require 'rack/head'
|
43
|
+
require 'set'
|
44
|
+
require 'singleton'
|
45
|
+
require 'zeitwerk'
|
46
|
+
|
47
|
+
loader = Zeitwerk::Loader.for_gem
|
48
|
+
loader.inflector.inflect(
|
49
|
+
'api' => 'API',
|
50
|
+
'dsl' => 'DSL'
|
51
|
+
)
|
52
|
+
railtie = "#{__dir__}/grape/railtie.rb"
|
53
|
+
loader.do_not_eager_load(railtie)
|
54
|
+
loader.setup
|
36
55
|
|
37
56
|
I18n.load_path << File.expand_path('grape/locale/en.yml', __dir__)
|
38
57
|
|
39
58
|
module Grape
|
40
59
|
include ActiveSupport::Configurable
|
41
|
-
extend ::ActiveSupport::Autoload
|
42
60
|
|
43
61
|
def self.deprecator
|
44
62
|
@deprecator ||= ActiveSupport::Deprecation.new('2.0', 'Grape')
|
45
63
|
end
|
46
64
|
|
47
|
-
def self.lowercase_headers?
|
48
|
-
Rack::CONTENT_TYPE == 'content-type'
|
49
|
-
end
|
50
|
-
|
51
|
-
eager_autoload do
|
52
|
-
autoload :API
|
53
|
-
autoload :Endpoint
|
54
|
-
|
55
|
-
autoload :Namespace
|
56
|
-
|
57
|
-
autoload :Path
|
58
|
-
autoload :Cookies
|
59
|
-
autoload :Validations
|
60
|
-
autoload :ErrorFormatter
|
61
|
-
autoload :Formatter
|
62
|
-
autoload :Parser
|
63
|
-
autoload :Request
|
64
|
-
autoload :Env, 'grape/util/env'
|
65
|
-
autoload :Json, 'grape/util/json'
|
66
|
-
autoload :Xml, 'grape/util/xml'
|
67
|
-
autoload :DryTypes
|
68
|
-
end
|
69
|
-
|
70
|
-
module Http
|
71
|
-
extend ::ActiveSupport::Autoload
|
72
|
-
eager_autoload do
|
73
|
-
autoload :Headers
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
module Exceptions
|
78
|
-
extend ::ActiveSupport::Autoload
|
79
|
-
eager_autoload do
|
80
|
-
autoload :Base
|
81
|
-
autoload :Validation
|
82
|
-
autoload :ValidationArrayErrors
|
83
|
-
autoload :ValidationErrors
|
84
|
-
autoload :MissingVendorOption
|
85
|
-
autoload :MissingMimeType
|
86
|
-
autoload :MissingOption
|
87
|
-
autoload :InvalidFormatter
|
88
|
-
autoload :InvalidVersionerOption
|
89
|
-
autoload :UnknownValidator
|
90
|
-
autoload :UnknownOptions
|
91
|
-
autoload :UnknownParameter
|
92
|
-
autoload :InvalidWithOptionForRepresent
|
93
|
-
autoload :IncompatibleOptionValues
|
94
|
-
autoload :MissingGroupType
|
95
|
-
autoload :UnsupportedGroupType
|
96
|
-
autoload :InvalidMessageBody
|
97
|
-
autoload :InvalidAcceptHeader
|
98
|
-
autoload :InvalidVersionHeader
|
99
|
-
autoload :MethodNotAllowed
|
100
|
-
autoload :InvalidResponse
|
101
|
-
autoload :EmptyMessageBody
|
102
|
-
autoload :TooManyMultipartFiles
|
103
|
-
autoload :MissingGroupTypeError, 'grape/exceptions/missing_group_type'
|
104
|
-
autoload :UnsupportedGroupTypeError, 'grape/exceptions/unsupported_group_type'
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
module Extensions
|
109
|
-
extend ::ActiveSupport::Autoload
|
110
|
-
eager_autoload do
|
111
|
-
autoload :Hash
|
112
|
-
end
|
113
|
-
module ActiveSupport
|
114
|
-
extend ::ActiveSupport::Autoload
|
115
|
-
eager_autoload do
|
116
|
-
autoload :HashWithIndifferentAccess
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
module Hashie
|
121
|
-
extend ::ActiveSupport::Autoload
|
122
|
-
eager_autoload do
|
123
|
-
autoload :Mash
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
module Middleware
|
129
|
-
extend ::ActiveSupport::Autoload
|
130
|
-
eager_autoload do
|
131
|
-
autoload :Base
|
132
|
-
autoload :Versioner
|
133
|
-
autoload :Formatter
|
134
|
-
autoload :Error
|
135
|
-
autoload :Globals
|
136
|
-
autoload :Stack
|
137
|
-
autoload :Helpers
|
138
|
-
end
|
139
|
-
|
140
|
-
module Auth
|
141
|
-
extend ::ActiveSupport::Autoload
|
142
|
-
eager_autoload do
|
143
|
-
autoload :Base
|
144
|
-
autoload :DSL
|
145
|
-
autoload :StrategyInfo
|
146
|
-
autoload :Strategies
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
module Versioner
|
151
|
-
extend ::ActiveSupport::Autoload
|
152
|
-
eager_autoload do
|
153
|
-
autoload :Path
|
154
|
-
autoload :Header
|
155
|
-
autoload :Param
|
156
|
-
autoload :AcceptVersionHeader
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
module Util
|
162
|
-
extend ::ActiveSupport::Autoload
|
163
|
-
eager_autoload do
|
164
|
-
autoload :InheritableValues
|
165
|
-
autoload :StackableValues
|
166
|
-
autoload :ReverseStackableValues
|
167
|
-
autoload :InheritableSetting
|
168
|
-
autoload :StrictHashConfiguration
|
169
|
-
autoload :Registrable
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
module ErrorFormatter
|
174
|
-
extend ::ActiveSupport::Autoload
|
175
|
-
eager_autoload do
|
176
|
-
autoload :Base
|
177
|
-
autoload :Json
|
178
|
-
autoload :Txt
|
179
|
-
autoload :Xml
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
module Formatter
|
184
|
-
extend ::ActiveSupport::Autoload
|
185
|
-
eager_autoload do
|
186
|
-
autoload :Json
|
187
|
-
autoload :SerializableHash
|
188
|
-
autoload :Txt
|
189
|
-
autoload :Xml
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
module Parser
|
194
|
-
extend ::ActiveSupport::Autoload
|
195
|
-
eager_autoload do
|
196
|
-
autoload :Json
|
197
|
-
autoload :Xml
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
module DSL
|
202
|
-
extend ::ActiveSupport::Autoload
|
203
|
-
eager_autoload do
|
204
|
-
autoload :API
|
205
|
-
autoload :Callbacks
|
206
|
-
autoload :Settings
|
207
|
-
autoload :Configuration
|
208
|
-
autoload :InsideRoute
|
209
|
-
autoload :Helpers
|
210
|
-
autoload :Middleware
|
211
|
-
autoload :Parameters
|
212
|
-
autoload :RequestResponse
|
213
|
-
autoload :Routing
|
214
|
-
autoload :Validations
|
215
|
-
autoload :Logger
|
216
|
-
autoload :Desc
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
class API
|
221
|
-
extend ::ActiveSupport::Autoload
|
222
|
-
eager_autoload do
|
223
|
-
autoload :Helpers
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
module Presenters
|
228
|
-
extend ::ActiveSupport::Autoload
|
229
|
-
eager_autoload do
|
230
|
-
autoload :Presenter
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
module ServeStream
|
235
|
-
extend ::ActiveSupport::Autoload
|
236
|
-
eager_autoload do
|
237
|
-
autoload :FileBody
|
238
|
-
autoload :SendfileResponse
|
239
|
-
autoload :StreamResponse
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
module Validations
|
244
|
-
extend ::ActiveSupport::Autoload
|
245
|
-
|
246
|
-
eager_autoload do
|
247
|
-
autoload :AttributesIterator
|
248
|
-
autoload :MultipleAttributesIterator
|
249
|
-
autoload :SingleAttributeIterator
|
250
|
-
autoload :Types
|
251
|
-
autoload :ParamsScope
|
252
|
-
autoload :ValidatorFactory
|
253
|
-
autoload :Base, 'grape/validations/validators/base'
|
254
|
-
end
|
255
|
-
|
256
|
-
module Types
|
257
|
-
extend ::ActiveSupport::Autoload
|
258
|
-
|
259
|
-
eager_autoload do
|
260
|
-
autoload :InvalidValue
|
261
|
-
autoload :DryTypeCoercer
|
262
|
-
autoload :ArrayCoercer
|
263
|
-
autoload :SetCoercer
|
264
|
-
autoload :PrimitiveCoercer
|
265
|
-
autoload :CustomTypeCoercer
|
266
|
-
autoload :CustomTypeCollectionCoercer
|
267
|
-
autoload :MultipleTypeCoercer
|
268
|
-
autoload :VariantCollectionCoercer
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
module Validators
|
273
|
-
extend ::ActiveSupport::Autoload
|
274
|
-
|
275
|
-
eager_autoload do
|
276
|
-
autoload :Base
|
277
|
-
autoload :MultipleParamsBase
|
278
|
-
autoload :AllOrNoneOfValidator
|
279
|
-
autoload :AllowBlankValidator
|
280
|
-
autoload :AsValidator
|
281
|
-
autoload :AtLeastOneOfValidator
|
282
|
-
autoload :CoerceValidator
|
283
|
-
autoload :DefaultValidator
|
284
|
-
autoload :ExactlyOneOfValidator
|
285
|
-
autoload :ExceptValuesValidator
|
286
|
-
autoload :MutualExclusionValidator
|
287
|
-
autoload :PresenceValidator
|
288
|
-
autoload :RegexpValidator
|
289
|
-
autoload :SameAsValidator
|
290
|
-
autoload :ValuesValidator
|
291
|
-
end
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
|
-
module Types
|
296
|
-
extend ::ActiveSupport::Autoload
|
297
|
-
|
298
|
-
eager_autoload do
|
299
|
-
autoload :InvalidValue
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
65
|
configure do |config|
|
304
66
|
config.param_builder = Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder
|
305
67
|
config.compile_methods!
|
306
68
|
end
|
307
69
|
end
|
308
70
|
|
309
|
-
require 'grape/content_types'
|
310
|
-
|
311
|
-
require 'grape/util/lazy_value'
|
312
|
-
require 'grape/util/lazy_block'
|
313
|
-
require 'grape/util/endpoint_configuration'
|
314
|
-
require 'grape/version'
|
315
|
-
|
316
71
|
# https://api.rubyonrails.org/classes/ActiveSupport/Deprecation.html
|
317
72
|
# adding Grape.deprecator to Rails App if any
|
318
73
|
require 'grape/railtie' if defined?(Rails::Railtie) && ActiveSupport.gem_version >= Gem::Version.new('7.1')
|
74
|
+
loader.eager_load
|
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: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,28 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: builder
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
26
|
+
version: '6'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: dry-types
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,30 +44,30 @@ dependencies:
|
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
47
|
+
version: 1.1.0
|
62
48
|
type: :runtime
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
54
|
+
version: 1.1.0
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rack
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: '2'
|
76
62
|
type: :runtime
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
66
|
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: '2'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
70
|
+
name: zeitwerk
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
73
|
- - ">="
|
@@ -129,8 +115,8 @@ files:
|
|
129
115
|
- lib/grape/dsl/routing.rb
|
130
116
|
- lib/grape/dsl/settings.rb
|
131
117
|
- lib/grape/dsl/validations.rb
|
132
|
-
- lib/grape/eager_load.rb
|
133
118
|
- lib/grape/endpoint.rb
|
119
|
+
- lib/grape/env.rb
|
134
120
|
- lib/grape/error_formatter.rb
|
135
121
|
- lib/grape/error_formatter/base.rb
|
136
122
|
- lib/grape/error_formatter/json.rb
|
@@ -168,6 +154,7 @@ files:
|
|
168
154
|
- lib/grape/formatter/txt.rb
|
169
155
|
- lib/grape/formatter/xml.rb
|
170
156
|
- lib/grape/http/headers.rb
|
157
|
+
- lib/grape/json.rb
|
171
158
|
- lib/grape/locale/en.yml
|
172
159
|
- lib/grape/middleware/auth/base.rb
|
173
160
|
- lib/grape/middleware/auth/dsl.rb
|
@@ -184,8 +171,8 @@ files:
|
|
184
171
|
- lib/grape/middleware/versioner/accept_version_header.rb
|
185
172
|
- lib/grape/middleware/versioner/header.rb
|
186
173
|
- lib/grape/middleware/versioner/param.rb
|
187
|
-
- lib/grape/middleware/versioner/parse_media_type_patch.rb
|
188
174
|
- lib/grape/middleware/versioner/path.rb
|
175
|
+
- lib/grape/middleware/versioner_helpers.rb
|
189
176
|
- lib/grape/namespace.rb
|
190
177
|
- lib/grape/parser.rb
|
191
178
|
- lib/grape/parser/json.rb
|
@@ -195,7 +182,8 @@ files:
|
|
195
182
|
- lib/grape/railtie.rb
|
196
183
|
- lib/grape/request.rb
|
197
184
|
- lib/grape/router.rb
|
198
|
-
- lib/grape/router/
|
185
|
+
- lib/grape/router/base_route.rb
|
186
|
+
- lib/grape/router/greedy_route.rb
|
199
187
|
- lib/grape/router/pattern.rb
|
200
188
|
- lib/grape/router/route.rb
|
201
189
|
- lib/grape/serve_stream/file_body.rb
|
@@ -205,21 +193,23 @@ files:
|
|
205
193
|
- lib/grape/util/base_inheritable.rb
|
206
194
|
- lib/grape/util/cache.rb
|
207
195
|
- lib/grape/util/endpoint_configuration.rb
|
208
|
-
- lib/grape/util/
|
196
|
+
- lib/grape/util/header.rb
|
209
197
|
- lib/grape/util/inheritable_setting.rb
|
210
198
|
- lib/grape/util/inheritable_values.rb
|
211
|
-
- lib/grape/util/
|
212
|
-
- lib/grape/util/
|
213
|
-
- lib/grape/util/
|
214
|
-
- lib/grape/util/
|
215
|
-
- lib/grape/util/
|
199
|
+
- lib/grape/util/lazy/block.rb
|
200
|
+
- lib/grape/util/lazy/object.rb
|
201
|
+
- lib/grape/util/lazy/value.rb
|
202
|
+
- lib/grape/util/lazy/value_array.rb
|
203
|
+
- lib/grape/util/lazy/value_enumerable.rb
|
204
|
+
- lib/grape/util/lazy/value_hash.rb
|
205
|
+
- lib/grape/util/media_type.rb
|
216
206
|
- lib/grape/util/reverse_stackable_values.rb
|
217
207
|
- lib/grape/util/stackable_values.rb
|
218
208
|
- lib/grape/util/strict_hash_configuration.rb
|
219
|
-
- lib/grape/util/xml.rb
|
220
209
|
- lib/grape/validations.rb
|
221
210
|
- lib/grape/validations/attributes_doc.rb
|
222
211
|
- lib/grape/validations/attributes_iterator.rb
|
212
|
+
- lib/grape/validations/contract_scope.rb
|
223
213
|
- lib/grape/validations/multiple_attributes_iterator.rb
|
224
214
|
- lib/grape/validations/params_scope.rb
|
225
215
|
- lib/grape/validations/single_attribute_iterator.rb
|
@@ -246,6 +236,7 @@ files:
|
|
246
236
|
- lib/grape/validations/validators/default_validator.rb
|
247
237
|
- lib/grape/validations/validators/exactly_one_of_validator.rb
|
248
238
|
- lib/grape/validations/validators/except_values_validator.rb
|
239
|
+
- lib/grape/validations/validators/length_validator.rb
|
249
240
|
- lib/grape/validations/validators/multiple_params_base.rb
|
250
241
|
- lib/grape/validations/validators/mutual_exclusion_validator.rb
|
251
242
|
- lib/grape/validations/validators/presence_validator.rb
|
@@ -253,14 +244,16 @@ files:
|
|
253
244
|
- lib/grape/validations/validators/same_as_validator.rb
|
254
245
|
- lib/grape/validations/validators/values_validator.rb
|
255
246
|
- lib/grape/version.rb
|
247
|
+
- lib/grape/xml.rb
|
256
248
|
homepage: https://github.com/ruby-grape/grape
|
257
249
|
licenses:
|
258
250
|
- MIT
|
259
251
|
metadata:
|
260
252
|
bug_tracker_uri: https://github.com/ruby-grape/grape/issues
|
261
|
-
changelog_uri: https://github.com/ruby-grape/grape/blob/v2.
|
262
|
-
documentation_uri: https://www.rubydoc.info/gems/grape/2.
|
263
|
-
source_code_uri: https://github.com/ruby-grape/grape/tree/v2.
|
253
|
+
changelog_uri: https://github.com/ruby-grape/grape/blob/v2.2.0/CHANGELOG.md
|
254
|
+
documentation_uri: https://www.rubydoc.info/gems/grape/2.2.0
|
255
|
+
source_code_uri: https://github.com/ruby-grape/grape/tree/v2.2.0
|
256
|
+
rubygems_mfa_required: 'true'
|
264
257
|
post_install_message:
|
265
258
|
rdoc_options: []
|
266
259
|
require_paths:
|
@@ -269,14 +262,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
269
262
|
requirements:
|
270
263
|
- - ">="
|
271
264
|
- !ruby/object:Gem::Version
|
272
|
-
version: 2.
|
265
|
+
version: 2.7.0
|
273
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
274
267
|
requirements:
|
275
268
|
- - ">="
|
276
269
|
- !ruby/object:Gem::Version
|
277
270
|
version: '0'
|
278
271
|
requirements: []
|
279
|
-
rubygems_version: 3.
|
272
|
+
rubygems_version: 3.5.13
|
280
273
|
signing_key:
|
281
274
|
specification_version: 4
|
282
275
|
summary: A simple Ruby framework for building REST-like APIs.
|