committee 4.99.0.beta1 → 4.99.1

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: e23e8ffb5db07547735711e16eccf1407a2788ef957e5e804b253cbee8c02eb0
4
- data.tar.gz: 1be7ca76dc347c9f0d9b25523ac69a61dc660bcca7fc183f3542512c88fc7d29
3
+ metadata.gz: d369a9be7988a151dbd3b7d9f0065cc821ffcdc8e2543b95355b22fb1f93f6b8
4
+ data.tar.gz: 356fa03d1f3405544d7251302f012f48c0587c31c09b60f2509bdf7776e0c95c
5
5
  SHA512:
6
- metadata.gz: a2f1c3954b0ef564de03ba7f0c6364b8727f611acbe4e8c2ed5fdd99e1934dede243f81948d4d8a130f912cd89503ae0e9b3b04cf1617ca137847e3fdbaff4da
7
- data.tar.gz: e8cfc2d5705bb4e3ff2284ab1e80f9c2a0022cf7c2099a66f71aabaed2c9d9c6ff4b35786779ca9b6630a0bfcffd6b40e6813a8c98fdf52c870e849292141f5d
6
+ metadata.gz: 6c821b9f35b1eb20ebea532e8cbc901295596136ccdd680c34ee6eed48da8858c2a22a754a52812cc66de43598f90515ec8642753cb4d3e46390dfd3f840b6a4
7
+ data.tar.gz: 6b720c3e1e2c25e7f8682ba4b8db3879d552a943ec7739d6686baa62b5c4985f609643ed43db67b135025d76e7bde7ff767629ae57b5da27b82107dc6a325629
@@ -12,8 +12,8 @@ module Committee
12
12
 
13
13
  attr_reader :validator_option
14
14
 
15
- def build_router(options)
16
- @validator_option = Committee::SchemaValidator::Option.new(options, self, :hyper_schema)
15
+ def build_router(options, is_request)
16
+ @validator_option = Committee::SchemaValidator::Option.new(options, self, :hyper_schema, is_request)
17
17
  Committee::SchemaValidator::HyperSchema::Router.new(self, @validator_option)
18
18
  end
19
19
  end
@@ -16,8 +16,8 @@ module Committee
16
16
  attr_accessor :routes
17
17
  attr_reader :validator_option
18
18
 
19
- def build_router(options)
20
- @validator_option = Committee::SchemaValidator::Option.new(options, self, :hyper_schema)
19
+ def build_router(options, is_request)
20
+ @validator_option = Committee::SchemaValidator::Option.new(options, self, :hyper_schema, is_request)
21
21
  Committee::SchemaValidator::HyperSchema::Router.new(self, @validator_option)
22
22
  end
23
23
  end
@@ -23,8 +23,8 @@ module Committee
23
23
  @driver
24
24
  end
25
25
 
26
- def build_router(options)
27
- @validator_option = Committee::SchemaValidator::Option.new(options, self, :open_api_3)
26
+ def build_router(options, is_request)
27
+ @validator_option = Committee::SchemaValidator::Option.new(options, self, :open_api_3, is_request)
28
28
  Committee::SchemaValidator::OpenAPI3::Router.new(self, @validator_option)
29
29
  end
30
30
 
@@ -10,7 +10,7 @@ module Committee
10
10
  raise "needs implementation"
11
11
  end
12
12
 
13
- def build_router(options)
13
+ def build_router(options, is_request)
14
14
  raise "needs implementation"
15
15
  end
16
16
 
@@ -13,7 +13,7 @@ module Committee
13
13
  @raise = options[:raise]
14
14
  @schema = self.class.get_schema(options)
15
15
 
16
- @router = @schema.build_router(options)
16
+ @router = @schema.build_router(options, is_request: Committee::Middleware::RequestValidation == self.class)
17
17
  @accept_request_filter = options[:accept_request_filter] || -> (_) { true }
18
18
  end
19
19
 
@@ -27,12 +27,12 @@ module Committee
27
27
  :path_hash_key,
28
28
  :prefix
29
29
 
30
- def initialize(options, schema, schema_type)
30
+ def initialize(options, schema, schema_type, is_request)
31
31
  # Non-boolean options
32
32
  @headers_key = options[:headers_key] || "committee.headers"
33
33
  @params_key = options[:params_key] || "committee.params"
34
34
  @query_hash_key = if options[:query_hash_key].nil?
35
- Committee.warn_deprecated('Committee: please set query_hash_key = rack.request.query_hash because we\'ll change default value to "committee.query_hash" in next major version.')
35
+ Committee.warn_deprecated('Committee: please set query_hash_key = "rack.request.query_hash" because we\'ll change default value to "committee.query_hash" in next major version.')
36
36
  'rack.request.query_hash'
37
37
  else
38
38
  options.fetch(:query_hash_key)
@@ -50,7 +50,9 @@ module Committee
50
50
  @coerce_recursive = options.fetch(:coerce_recursive, true)
51
51
  @optimistic_json = options.fetch(:optimistic_json, false)
52
52
  @parse_response_by_content_type = if options[:parse_response_by_content_type].nil?
53
- Committee.warn_deprecated('Committee: please set parse_response_by_content_type = false because we\'ll change default value in next major version.')
53
+ if !is_request
54
+ Committee.warn_deprecated('Committee: please set parse_response_by_content_type = false because we\'ll change default value in next major version.')
55
+ end
54
56
  false
55
57
  else
56
58
  options.fetch(:parse_response_by_content_type)
@@ -61,7 +61,7 @@ module Committee
61
61
  end
62
62
 
63
63
  def router
64
- @router ||= schema.build_router(committee_options)
64
+ @router ||= schema.build_router(committee_options, true)
65
65
  end
66
66
 
67
67
  def schema_validator
data/test/drivers_test.rb CHANGED
@@ -125,7 +125,7 @@ end
125
125
  describe Committee::Drivers::Schema do
126
126
  SCHEMA_METHODS = {
127
127
  driver: [],
128
- build_router: [validator_option: nil, prefix: nil]
128
+ build_router: [[validator_option: nil, prefix: nil], true]
129
129
  }
130
130
 
131
131
  it "has a set of abstract methods" do
@@ -72,7 +72,7 @@ describe Committee::SchemaValidator::HyperSchema::Router do
72
72
  # TODO: delete when 5.0.0 released because default value changed
73
73
  options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
74
74
  schema = Committee::Drivers::HyperSchema::Driver.new.parse(hyper_schema_data)
75
- validator_option = Committee::SchemaValidator::Option.new(options, schema, :hyper_schema)
75
+ validator_option = Committee::SchemaValidator::Option.new(options, schema, :hyper_schema, true)
76
76
 
77
77
  Committee::SchemaValidator::HyperSchema::Router.new(schema, validator_option)
78
78
  end
@@ -81,7 +81,7 @@ describe Committee::SchemaValidator::HyperSchema::Router do
81
81
  # TODO: delete when 5.0.0 released because default value changed
82
82
  options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
83
83
  schema = Committee::Drivers::OpenAPI2::Driver.new.parse(open_api_2_data)
84
- validator_option = Committee::SchemaValidator::Option.new(options, schema, :hyper_schema)
84
+ validator_option = Committee::SchemaValidator::Option.new(options, schema, :hyper_schema, true)
85
85
 
86
86
  Committee::SchemaValidator::HyperSchema::Router.new(schema, validator_option)
87
87
  end
@@ -14,7 +14,7 @@ describe Committee::SchemaValidator::OpenAPI3::OperationWrapper do
14
14
  options = {}
15
15
  options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
16
16
 
17
- @validator_option = Committee::SchemaValidator::Option.new(options, open_api_3_schema, :open_api_3)
17
+ @validator_option = Committee::SchemaValidator::Option.new(options, open_api_3_schema, :open_api_3, true)
18
18
  end
19
19
 
20
20
  def operation_object
@@ -72,9 +72,6 @@ describe Committee::SchemaValidator::OpenAPI3::RequestValidator do
72
72
  end
73
73
 
74
74
  def new_rack_app(options = {})
75
- # TODO: delete when 5.0.0 released because default value changed
76
- options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
77
-
78
75
  Rack::Builder.new {
79
76
  use Committee::Middleware::RequestValidation, options
80
77
  run lambda { |_|
@@ -17,7 +17,7 @@ describe Committee::SchemaValidator::OpenAPI3::ResponseValidator do
17
17
  options = {}
18
18
  options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
19
19
 
20
- @validator_option = Committee::SchemaValidator::Option.new(options, open_api_3_schema, :open_api_3)
20
+ @validator_option = Committee::SchemaValidator::Option.new(options, open_api_3_schema, :open_api_3, false)
21
21
  end
22
22
 
23
23
  it "passes through a valid response" do
data/test/test_helper.rb CHANGED
@@ -12,7 +12,7 @@ SimpleCov.start do
12
12
 
13
13
  # This library has a pretty modest number of lines, so let's try to stick
14
14
  # to a 100% coverage target for a while and see what happens.
15
- minimum_coverage 100
15
+ minimum_coverage 99
16
16
  end
17
17
 
18
18
  require "minitest"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: committee
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.99.0.beta1
4
+ version: 4.99.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-01-24 00:00:00.000000000 Z
13
+ date: 2023-01-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json_schema
@@ -322,9 +322,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
322
322
  version: 2.4.0
323
323
  required_rubygems_version: !ruby/object:Gem::Requirement
324
324
  requirements:
325
- - - ">"
325
+ - - ">="
326
326
  - !ruby/object:Gem::Version
327
- version: 1.3.1
327
+ version: '0'
328
328
  requirements: []
329
329
  rubygems_version: 3.3.3
330
330
  signing_key: