rails-param-validation 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea025e319c6a3d02b8781c6c80ffc068cb72b8d694e3dc1fc843656f2dd4b862
4
- data.tar.gz: 9f1f786ec22824cb5ae9eaa8a33ef39d5a147ac9ed19d570e6414513cf418adf
3
+ metadata.gz: 93474c2cebc9d9ea2ee438a37054a775bf70bd66af809b6b6ebecd1213b29d24
4
+ data.tar.gz: 3354b776b3f8e9d63551ed1d6e51c350a52eb9aef68eedbcdd5437ab570520de
5
5
  SHA512:
6
- metadata.gz: a2ec3191599ac5b8fa5a4dbcf7684759de23a129be732e90275298b358e9d84d53cb653225413cadc229ad03b1e9baecac9dbce2e2269b1d8b9e8344a21b3fff
7
- data.tar.gz: 980cf1cde5a0d0500da47c4eb69ec514a28c0da4eb769b13d23d443f63d5587faf915c23705b6178c02817d6665bda3249cc1862bcc1c10093e04b6d1c7514d9
6
+ metadata.gz: dbf491a6d35b6c7bd6a230aabd4662e66ed40a522020ad55214fa1ef41909103f7e007e12f6aca01b27d0890684762305a6bab419662920ed5af109c5a998487
7
+ data.tar.gz: 9019f5b9aa9c753ae3de87a81a88ce5b2a74401ef9fde6b67708b2b24f5eb50b386641b9b6d95d0cfe21c5d0626b3b16673d996a4aa4f00df46d9e847f998c49
@@ -31,6 +31,7 @@ module RailsParamValidation
31
31
  attr_accessor :default_body_content_type
32
32
  attr_accessor :default_action_flags
33
33
  attr_accessor :post_action_definition_hook
34
+ attr_accessor :auto_include_in_classes
34
35
  attr_reader :openapi
35
36
 
36
37
  def initialize
@@ -41,6 +42,7 @@ module RailsParamValidation
41
42
  @default_body_content_type = 'application/json'
42
43
  @default_action_flags = {}
43
44
  @post_action_definition_hook = ->(_action_definition) {}
45
+ @auto_include_in_classes = %w[ActionController::Base ActionController::API]
44
46
  end
45
47
  end
46
48
 
@@ -17,15 +17,14 @@ module RailsParamValidation
17
17
 
18
18
  initializer 'rails_param_validation.action_controller_extension' do
19
19
  ActiveSupport.on_load(:action_controller) do
20
- ActionController::Base.send :include, ActionControllerExtension
21
- ActionController::Base.send :include, AnnotationExtension
22
- ActionController::Base.send :include, CustomTypesExtension
23
- ActionController::Base.send :extend, RailsParamValidation::Types
24
-
25
- ActionController::API.send :include, ActionControllerExtension
26
- ActionController::API.send :include, AnnotationExtension
27
- ActionController::API.send :include, CustomTypesExtension
28
- ActionController::API.send :extend, RailsParamValidation::Types
20
+ RailsParamValidation.config.auto_include_in_classes.each do |klass_name|
21
+ klass = klass_name.constantize
22
+
23
+ klass.send :include, ActionControllerExtension
24
+ klass.send :include, AnnotationExtension
25
+ klass.send :include, CustomTypesExtension
26
+ klass.send :extend, RailsParamValidation::Types
27
+ end
29
28
  end
30
29
  end
31
30
 
@@ -6,11 +6,6 @@ module RailsParamValidation
6
6
  end
7
7
 
8
8
  def matches?(path, data)
9
- if schema.schema.is_a? NilClass
10
- puts path
11
- puts schema.inspect
12
- end
13
-
14
9
  ValidatorFactory.create(schema.schema).matches? path, data
15
10
  end
16
11
 
@@ -29,4 +24,4 @@ module RailsParamValidation
29
24
  end
30
25
  end
31
26
 
32
- end
27
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsParamValidation
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-param-validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oskar Kirmis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-04 00:00:00.000000000 Z
11
+ date: 2020-08-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Declarative parameter definition and validation for Rails
14
14
  email:
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
- rubygems_version: 3.1.2
96
+ rubygems_version: 3.0.2
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Declarative parameter definition and validation for Rails