committee 5.1.0 → 5.3.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/lib/committee/drivers.rb +6 -0
- data/lib/committee/middleware/request_validation.rb +1 -1
- data/lib/committee/schema_validator/hyper_schema/response_validator.rb +14 -4
- data/lib/committee/schema_validator/hyper_schema.rb +1 -1
- data/lib/committee/schema_validator/open_api_3.rb +2 -2
- data/lib/committee/schema_validator/option.rb +29 -20
- data/lib/committee/version.rb +1 -1
- data/lib/committee.rb +1 -1
- data/test/bin/committee_stub_test.rb +0 -2
- data/test/committee_test.rb +8 -6
- data/test/drivers_test.rb +14 -0
- data/test/middleware/base_test.rb +0 -3
- data/test/middleware/request_validation_open_api_3_test.rb +3 -6
- data/test/middleware/request_validation_test.rb +0 -3
- data/test/middleware/response_validation_open_api_3_test.rb +0 -3
- data/test/middleware/response_validation_test.rb +23 -11
- data/test/middleware/stub_test.rb +0 -3
- data/test/schema_validator/hyper_schema/router_test.rb +0 -4
- data/test/schema_validator/open_api_3/operation_wrapper_test.rb +1 -6
- data/test/schema_validator/open_api_3/request_validator_test.rb +0 -3
- data/test/schema_validator/open_api_3/response_validator_test.rb +1 -5
- data/test/test/methods_new_version_test.rb +0 -3
- data/test/test/methods_test.rb +0 -3
- data/test/test_helper.rb +12 -1
- metadata +12 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ec0b5b55c4e5f1be93511f36d4ae210f7318232ab1aa421bbac14f3f172f2ef
|
4
|
+
data.tar.gz: 96ecf2cdc5e4053c1eec56c0ea5d27ec5c4353230b508385fd84f39f486a4baf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5d0d3daa686424b1dbab55e684ca483aff5a060c423c1bdc6796fcf1bbf4de918595d94f8df579918067778c8ab311fb7ba0c4ed34c5d4246ef21600c35d2af
|
7
|
+
data.tar.gz: 90a8511576aae0756b4e817b3dc61e4b55b5e2fdb744b1125f5892e09b544a7b7e01c746b5b510d986031d6ecf072ed5f246e125745790e0eb0384d4fdee7f16
|
data/lib/committee/drivers.rb
CHANGED
@@ -70,6 +70,12 @@ module Committee
|
|
70
70
|
return Committee::Drivers::OpenAPI3::Driver.new.parse(openapi)
|
71
71
|
end
|
72
72
|
|
73
|
+
if (version = hash['openapi'])
|
74
|
+
if Gem::Version.new(version) >= Gem::Version.new("3.1")
|
75
|
+
raise OpenAPI3Unsupported.new('Committee does not support OpenAPI 3.1+ yet')
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
73
79
|
driver = if hash['swagger'] == '2.0'
|
74
80
|
Committee::Drivers::OpenAPI2::Driver.new
|
75
81
|
else
|
@@ -4,11 +4,12 @@ module Committee
|
|
4
4
|
module SchemaValidator
|
5
5
|
class HyperSchema
|
6
6
|
class ResponseValidator
|
7
|
-
attr_reader :validate_success_only
|
7
|
+
attr_reader :allow_blank_structures, :validate_success_only
|
8
8
|
|
9
9
|
def initialize(link, options = {})
|
10
10
|
@link = link
|
11
11
|
@validate_success_only = options[:validate_success_only]
|
12
|
+
@allow_blank_structures = options[:allow_blank_structures]
|
12
13
|
|
13
14
|
@validator = JsonSchema::Validator.new(target_schema(link))
|
14
15
|
end
|
@@ -39,9 +40,18 @@ module Committee
|
|
39
40
|
return if data == nil
|
40
41
|
end
|
41
42
|
|
42
|
-
if Committee::
|
43
|
-
|
44
|
-
|
43
|
+
if allow_blank_structures && @link.is_a?(Committee::Drivers::OpenAPI2::Link) && !@link.target_schema
|
44
|
+
return if data.nil?
|
45
|
+
end
|
46
|
+
|
47
|
+
begin
|
48
|
+
if Committee::Middleware::ResponseValidation.validate?(status, validate_success_only) && !@validator.validate(data)
|
49
|
+
errors = JsonSchema::SchemaError.aggregate(@validator.errors).join("\n")
|
50
|
+
raise InvalidResponse, "Invalid response.\n\n#{errors}"
|
51
|
+
end
|
52
|
+
rescue => e
|
53
|
+
raise InvalidResponse, "Invalid response.\n\nschema is undefined" if /undefined method .all_of. for nil/ =~ e.message
|
54
|
+
raise e
|
45
55
|
end
|
46
56
|
end
|
47
57
|
|
@@ -33,7 +33,7 @@ module Committee
|
|
33
33
|
data = JSON.parse(full_body) if parse_to_json
|
34
34
|
end
|
35
35
|
|
36
|
-
Committee::SchemaValidator::HyperSchema::ResponseValidator.new(link, validate_success_only: validator_option.validate_success_only).call(status, headers, data)
|
36
|
+
Committee::SchemaValidator::HyperSchema::ResponseValidator.new(link, validate_success_only: validator_option.validate_success_only, allow_blank_structures: validator_option.allow_blank_structures).call(status, headers, data)
|
37
37
|
end
|
38
38
|
|
39
39
|
def link_exist?
|
@@ -87,7 +87,7 @@ module Committee
|
|
87
87
|
|
88
88
|
request.env[validator_option.headers_key] = unpacker.unpack_headers(request)
|
89
89
|
|
90
|
-
request_param,
|
90
|
+
request_param, _is_form_params = unpacker.unpack_request_params(request)
|
91
91
|
request.env[validator_option.request_body_hash_key] = request_param
|
92
92
|
request.env[validator_option.path_hash_key] = coerce_path_params
|
93
93
|
|
@@ -97,7 +97,7 @@ module Committee
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def copy_coerced_data_to_params(request)
|
100
|
-
order = if validator_option.
|
100
|
+
order = if validator_option.parameter_overwrite_by_rails_rule
|
101
101
|
# (high priority) path_hash_key -> query_param -> request_body_hash
|
102
102
|
[validator_option.request_body_hash_key, validator_option.query_hash_key, validator_option.path_hash_key]
|
103
103
|
else
|
@@ -4,7 +4,8 @@ module Committee
|
|
4
4
|
module SchemaValidator
|
5
5
|
class Option
|
6
6
|
# Boolean Options
|
7
|
-
attr_reader :
|
7
|
+
attr_reader :allow_blank_structures,
|
8
|
+
:allow_form_params,
|
8
9
|
:allow_get_body,
|
9
10
|
:allow_query_params,
|
10
11
|
:check_content_type,
|
@@ -17,7 +18,7 @@ module Committee
|
|
17
18
|
:optimistic_json,
|
18
19
|
:validate_success_only,
|
19
20
|
:parse_response_by_content_type,
|
20
|
-
:
|
21
|
+
:parameter_overwrite_by_rails_rule
|
21
22
|
|
22
23
|
# Non-boolean options:
|
23
24
|
attr_reader :headers_key,
|
@@ -29,30 +30,38 @@ module Committee
|
|
29
30
|
|
30
31
|
def initialize(options, schema, schema_type)
|
31
32
|
# Non-boolean options
|
32
|
-
@headers_key
|
33
|
-
@params_key
|
34
|
-
@query_hash_key
|
35
|
-
@path_hash_key
|
33
|
+
@headers_key = options[:headers_key] || "committee.headers"
|
34
|
+
@params_key = options[:params_key] || "committee.params"
|
35
|
+
@query_hash_key = options[:query_hash_key] || "committee.query_hash"
|
36
|
+
@path_hash_key = options[:path_hash_key] || "committee.path_hash"
|
36
37
|
@request_body_hash_key = options[:request_body_hash_key] || "committee.request_body_hash"
|
37
38
|
|
38
|
-
@prefix
|
39
|
+
@prefix = options[:prefix]
|
39
40
|
|
40
41
|
# Boolean options and have a common value by default
|
41
|
-
@
|
42
|
-
@
|
43
|
-
@
|
44
|
-
@
|
45
|
-
@
|
46
|
-
@
|
47
|
-
@
|
48
|
-
@
|
42
|
+
@allow_blank_structures = options.fetch(:allow_blank_structures, false)
|
43
|
+
@allow_form_params = options.fetch(:allow_form_params, true)
|
44
|
+
@allow_query_params = options.fetch(:allow_query_params, true)
|
45
|
+
@check_content_type = options.fetch(:check_content_type, true)
|
46
|
+
@check_header = options.fetch(:check_header, true)
|
47
|
+
@coerce_recursive = options.fetch(:coerce_recursive, true)
|
48
|
+
@optimistic_json = options.fetch(:optimistic_json, false)
|
49
|
+
@parse_response_by_content_type = options.fetch(:parse_response_by_content_type, true)
|
50
|
+
|
51
|
+
@parameter_overwrite_by_rails_rule =
|
52
|
+
if options.key?(:parameter_overwite_by_rails_rule)
|
53
|
+
Committee.warn_deprecated_until_6(true, "The option `parameter_overwite_by_rails_rule` is deprecated. Use `parameter_overwrite_by_rails_rule` instead.")
|
54
|
+
options[:parameter_overwite_by_rails_rule]
|
55
|
+
else
|
56
|
+
options.fetch(:parameter_overwrite_by_rails_rule, true)
|
57
|
+
end
|
49
58
|
|
50
59
|
# Boolean options and have a different value by default
|
51
|
-
@allow_get_body
|
52
|
-
@coerce_date_times
|
53
|
-
@coerce_form_params
|
54
|
-
@coerce_path_params
|
55
|
-
@coerce_query_params
|
60
|
+
@allow_get_body = options.fetch(:allow_get_body, schema.driver.default_allow_get_body)
|
61
|
+
@coerce_date_times = options.fetch(:coerce_date_times, schema.driver.default_coerce_date_times)
|
62
|
+
@coerce_form_params = options.fetch(:coerce_form_params, schema.driver.default_coerce_form_params)
|
63
|
+
@coerce_path_params = options.fetch(:coerce_path_params, schema.driver.default_path_params)
|
64
|
+
@coerce_query_params = options.fetch(:coerce_query_params, schema.driver.default_query_params)
|
56
65
|
@validate_success_only = options.fetch(:validate_success_only, schema.driver.default_validate_success_only)
|
57
66
|
end
|
58
67
|
end
|
data/lib/committee/version.rb
CHANGED
data/lib/committee.rb
CHANGED
@@ -22,7 +22,7 @@ module Committee
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.warn_deprecated_until_6(cond, message)
|
25
|
-
raise "remove deprecated!"
|
25
|
+
raise "remove deprecated!" unless Committee::VERSION.start_with?("5")
|
26
26
|
warn("[DEPRECATION] #{message}") if cond
|
27
27
|
end
|
28
28
|
end
|
data/test/committee_test.rb
CHANGED
@@ -19,13 +19,15 @@ describe Committee do
|
|
19
19
|
old_stderr = $stderr
|
20
20
|
$stderr = StringIO.new
|
21
21
|
begin
|
22
|
-
stub(
|
23
|
-
|
24
|
-
|
22
|
+
Committee.stub(:debug?, false) do
|
23
|
+
Committee.log_debug "blah"
|
24
|
+
assert_equal "", $stderr.string
|
25
|
+
end
|
25
26
|
|
26
|
-
stub(
|
27
|
-
|
28
|
-
|
27
|
+
Committee.stub(:debug?, true) do
|
28
|
+
Committee.log_debug "blah"
|
29
|
+
assert_equal "blah\n", $stderr.string
|
30
|
+
end
|
29
31
|
ensure
|
30
32
|
$stderr = old_stderr
|
31
33
|
end
|
data/test/drivers_test.rb
CHANGED
@@ -48,6 +48,13 @@ describe Committee::Drivers do
|
|
48
48
|
assert_kind_of Committee::Drivers::OpenAPI3::Schema, s
|
49
49
|
end
|
50
50
|
|
51
|
+
it 'fails to load OpenAPI 3.1+' do
|
52
|
+
e = assert_raises(Committee::OpenAPI3Unsupported) do
|
53
|
+
Committee::Drivers.load_from_file(open_api_3_1_schema_path, parser_options:{strict_reference_validation: true})
|
54
|
+
end
|
55
|
+
assert_equal 'Committee does not support OpenAPI 3.1+ yet', e.message
|
56
|
+
end
|
57
|
+
|
51
58
|
it 'fails to load OpenAPI 3 with invalid reference' do
|
52
59
|
parser_options = { strict_reference_validation: true }
|
53
60
|
assert_raises(OpenAPIParser::MissingReferenceError) do
|
@@ -138,6 +145,13 @@ describe Committee::Drivers do
|
|
138
145
|
assert_kind_of Committee::Drivers::Schema, s
|
139
146
|
assert_kind_of Committee::Drivers::HyperSchema::Schema, s
|
140
147
|
end
|
148
|
+
|
149
|
+
it 'fails to load OpenAPI 3.1+' do
|
150
|
+
e = assert_raises(Committee::OpenAPI3Unsupported) do
|
151
|
+
Committee::Drivers.load_from_data(open_api_3_1_data)
|
152
|
+
end
|
153
|
+
assert_equal 'Committee does not support OpenAPI 3.1+ yet', e.message
|
154
|
+
end
|
141
155
|
end
|
142
156
|
end
|
143
157
|
|
@@ -117,9 +117,6 @@ describe Committee::Middleware::Base do
|
|
117
117
|
private
|
118
118
|
|
119
119
|
def new_rack_app(options = {})
|
120
|
-
# TODO: delete when 5.0.0 released because default value changed
|
121
|
-
options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
|
122
|
-
|
123
120
|
Rack::Builder.new {
|
124
121
|
use Committee::Middleware::RequestValidation, options
|
125
122
|
run lambda { |_|
|
@@ -419,7 +419,7 @@ describe Committee::Middleware::RequestValidation do
|
|
419
419
|
assert_equal env['committee.query_hash']['integer'], 42
|
420
420
|
#assert_equal env['rack.request.query_hash'][:integer], 42 # this isn't hash indifferent hash because we use rack.request.query_hash
|
421
421
|
[204, {}, []]
|
422
|
-
end, schema: open_api_3_schema,
|
422
|
+
end, schema: open_api_3_schema, parameter_overwrite_by_rails_rule: false)
|
423
423
|
|
424
424
|
header "Content-Type", "application/json"
|
425
425
|
post '/overwrite_same_parameter?integer=42'
|
@@ -434,7 +434,7 @@ describe Committee::Middleware::RequestValidation do
|
|
434
434
|
assert_equal env['committee.request_body_hash'][:integer], 21
|
435
435
|
assert_equal env['committee.query_hash']['integer'], 42
|
436
436
|
[204, {}, []]
|
437
|
-
end, schema: open_api_3_schema,
|
437
|
+
end, schema: open_api_3_schema, parameter_overwrite_by_rails_rule: false)
|
438
438
|
|
439
439
|
params = {integer: 21}
|
440
440
|
|
@@ -454,7 +454,7 @@ describe Committee::Middleware::RequestValidation do
|
|
454
454
|
assert_equal env['committee.query_hash']['integer'], 84 # we can't use query_parameter :(
|
455
455
|
#assert_equal env['rack.request.query_hash'][:integer], 21 # this isn't hash indifferent hash because we use rack.request.query_hash
|
456
456
|
[204, {}, []]
|
457
|
-
end, schema: open_api_3_schema,
|
457
|
+
end, schema: open_api_3_schema, parameter_overwrite_by_rails_rule: false)
|
458
458
|
|
459
459
|
params = {integer: 21}
|
460
460
|
|
@@ -615,9 +615,6 @@ describe Committee::Middleware::RequestValidation do
|
|
615
615
|
end
|
616
616
|
|
617
617
|
def new_rack_app_with_lambda(check_lambda, options = {})
|
618
|
-
# TODO: delete when 5.0.0 released because default value changed
|
619
|
-
options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
|
620
|
-
|
621
618
|
Rack::Builder.new {
|
622
619
|
use Committee::Middleware::RequestValidation, options
|
623
620
|
run check_lambda
|
@@ -505,9 +505,6 @@ describe Committee::Middleware::RequestValidation do
|
|
505
505
|
|
506
506
|
|
507
507
|
def new_rack_app_with_lambda(check_lambda, options = {})
|
508
|
-
# TODO: delete when 5.0.0 released because default value changed
|
509
|
-
options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
|
510
|
-
|
511
508
|
Rack::Builder.new {
|
512
509
|
use Committee::Middleware::RequestValidation, options
|
513
510
|
run check_lambda
|
@@ -273,9 +273,6 @@ describe Committee::Middleware::ResponseValidation do
|
|
273
273
|
private
|
274
274
|
|
275
275
|
def new_response_rack(response, headers = {}, options = {}, rack_options = {})
|
276
|
-
# TODO: delete when 5.0.0 released because default value changed
|
277
|
-
options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
|
278
|
-
|
279
276
|
status = rack_options[:status] || 200
|
280
277
|
content_type = rack_options[:content_type] || "application/json"
|
281
278
|
headers = {
|
@@ -15,14 +15,6 @@ describe Committee::Middleware::ResponseValidation do
|
|
15
15
|
assert_equal 200, last_response.status
|
16
16
|
end
|
17
17
|
|
18
|
-
# TODO: remove 5.0.0
|
19
|
-
it "passes through a valid response" do
|
20
|
-
# will show deprecated message
|
21
|
-
@app = new_rack_app(JSON.generate([ValidApp]), {}, schema: hyper_schema, strict: true)
|
22
|
-
get "/apps"
|
23
|
-
assert_equal 200, last_response.status
|
24
|
-
end
|
25
|
-
|
26
18
|
it "doesn't call error_handler (has a arg) when response is valid" do
|
27
19
|
called = false
|
28
20
|
pr = ->(_e) { called = true }
|
@@ -144,6 +136,29 @@ describe Committee::Middleware::ResponseValidation do
|
|
144
136
|
assert_equal 200, last_response.status
|
145
137
|
end
|
146
138
|
|
139
|
+
it "passes through a valid response for OpenAPI when data=nil, target_schema=empty, allow_blank_structures=true" do
|
140
|
+
@app = new_rack_app("null", {},
|
141
|
+
allow_blank_structures: true, schema: open_api_2_schema)
|
142
|
+
get "/api/pets/cat"
|
143
|
+
assert_equal 200, last_response.status
|
144
|
+
end
|
145
|
+
|
146
|
+
it "invalid responses for OpenAPI when data=nil, target_schema=empty, allow_blank_structures=false" do
|
147
|
+
@app = new_rack_app("null", {},
|
148
|
+
allow_blank_structures: false, schema: open_api_2_schema)
|
149
|
+
get "/api/pets/cat"
|
150
|
+
assert_equal 500, last_response.status
|
151
|
+
assert_match(/Invalid response/i, last_response.body)
|
152
|
+
end
|
153
|
+
|
154
|
+
it "passes through a valid response for OpenAPI when data=nil, target_schema=present, allow_blank_structures=true" do
|
155
|
+
@app = new_rack_app("null", {},
|
156
|
+
allow_blank_structures: true, schema: open_api_2_schema)
|
157
|
+
get "/api/pets/dog"
|
158
|
+
assert_equal 500, last_response.status
|
159
|
+
assert_match(/nil is not an array/i, last_response.body)
|
160
|
+
end
|
161
|
+
|
147
162
|
it "detects an invalid response for OpenAPI" do
|
148
163
|
@app = new_rack_app("{_}", {}, schema: open_api_2_schema)
|
149
164
|
get "/api/pets"
|
@@ -173,9 +188,6 @@ describe Committee::Middleware::ResponseValidation do
|
|
173
188
|
private
|
174
189
|
|
175
190
|
def new_rack_app(response, headers = {}, options = {})
|
176
|
-
# TODO: delete when 5.0.0 released because default value changed
|
177
|
-
options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
|
178
|
-
|
179
191
|
headers = {
|
180
192
|
"Content-Type" => "application/json"
|
181
193
|
}.merge(headers)
|
@@ -113,9 +113,6 @@ describe Committee::Middleware::Stub do
|
|
113
113
|
response = options.delete(:response)
|
114
114
|
suppress = options.delete(:suppress)
|
115
115
|
|
116
|
-
# TODO: delete when 5.0.0 released because default value changed
|
117
|
-
options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
|
118
|
-
|
119
116
|
Rack::Builder.new {
|
120
117
|
use Committee::Middleware::Stub, options
|
121
118
|
run lambda { |env|
|
@@ -69,8 +69,6 @@ describe Committee::SchemaValidator::HyperSchema::Router do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def hyper_schema_router(options = {})
|
72
|
-
# TODO: delete when 5.0.0 released because default value changed
|
73
|
-
options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
|
74
72
|
schema = Committee::Drivers::HyperSchema::Driver.new.parse(hyper_schema_data)
|
75
73
|
validator_option = Committee::SchemaValidator::Option.new(options, schema, :hyper_schema)
|
76
74
|
|
@@ -78,8 +76,6 @@ describe Committee::SchemaValidator::HyperSchema::Router do
|
|
78
76
|
end
|
79
77
|
|
80
78
|
def open_api_2_router(options = {})
|
81
|
-
# TODO: delete when 5.0.0 released because default value changed
|
82
|
-
options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
|
83
79
|
schema = Committee::Drivers::OpenAPI2::Driver.new.parse(open_api_2_data)
|
84
80
|
validator_option = Committee::SchemaValidator::Option.new(options, schema, :hyper_schema)
|
85
81
|
|
@@ -9,12 +9,7 @@ describe Committee::SchemaValidator::OpenAPI3::OperationWrapper do
|
|
9
9
|
before do
|
10
10
|
@path = '/validate'
|
11
11
|
@method = 'post'
|
12
|
-
|
13
|
-
# TODO: delete when 5.0.0 released because default value changed
|
14
|
-
options = {}
|
15
|
-
options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
|
16
|
-
|
17
|
-
@validator_option = Committee::SchemaValidator::Option.new(options, open_api_3_schema, :open_api_3)
|
12
|
+
@validator_option = Committee::SchemaValidator::Option.new({}, open_api_3_schema, :open_api_3)
|
18
13
|
end
|
19
14
|
|
20
15
|
def operation_object
|
@@ -96,9 +96,6 @@ describe Committee::SchemaValidator::OpenAPI3::RequestValidator do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def new_rack_app(options = {})
|
99
|
-
# TODO: delete when 5.0.0 released because default value changed
|
100
|
-
options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
|
101
|
-
|
102
99
|
Rack::Builder.new {
|
103
100
|
use Committee::Middleware::RequestValidation, options
|
104
101
|
run lambda { |_|
|
@@ -13,11 +13,7 @@ describe Committee::SchemaValidator::OpenAPI3::ResponseValidator do
|
|
13
13
|
@path = '/validate'
|
14
14
|
@method = 'post'
|
15
15
|
|
16
|
-
|
17
|
-
options = {}
|
18
|
-
options[:parse_response_by_content_type] = true if options[:parse_response_by_content_type] == nil
|
19
|
-
|
20
|
-
@validator_option = Committee::SchemaValidator::Option.new(options, open_api_3_schema, :open_api_3)
|
16
|
+
@validator_option = Committee::SchemaValidator::Option.new({}, open_api_3_schema, :open_api_3)
|
21
17
|
end
|
22
18
|
|
23
19
|
it "passes through a valid response" do
|
@@ -30,9 +30,6 @@ describe Committee::Test::Methods do
|
|
30
30
|
@committee_schema = nil
|
31
31
|
|
32
32
|
@committee_options = {schema: hyper_schema}
|
33
|
-
|
34
|
-
# TODO: delete when 5.0.0 released because default value changed
|
35
|
-
@committee_options[:parse_response_by_content_type] = false
|
36
33
|
end
|
37
34
|
|
38
35
|
describe "#assert_schema_conform" do
|
data/test/test/methods_test.rb
CHANGED
@@ -29,9 +29,6 @@ describe Committee::Test::Methods do
|
|
29
29
|
@committee_router = nil
|
30
30
|
@committee_schema = nil
|
31
31
|
@committee_options = {}
|
32
|
-
|
33
|
-
# TODO: delete when 5.0.0 released because default value changed
|
34
|
-
@committee_options[:parse_response_by_content_type] = true
|
35
32
|
end
|
36
33
|
|
37
34
|
describe "Hyper-Schema" do
|
data/test/test_helper.rb
CHANGED
@@ -21,7 +21,6 @@ require "minitest"
|
|
21
21
|
require "minitest/spec"
|
22
22
|
require "minitest/autorun"
|
23
23
|
require "rack/test"
|
24
|
-
require "rr"
|
25
24
|
require "pry"
|
26
25
|
require "stringio"
|
27
26
|
|
@@ -91,6 +90,14 @@ def open_api_3_data
|
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
93
|
+
def open_api_3_1_data
|
94
|
+
if YAML.respond_to?(:unsafe_load_file)
|
95
|
+
YAML.unsafe_load_file(open_api_3_1_schema_path)
|
96
|
+
else
|
97
|
+
YAML.load_file(open_api_3_1_schema_path)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
94
101
|
def hyper_schema_schema_path
|
95
102
|
"./test/data/hyperschema/paas.json"
|
96
103
|
end
|
@@ -115,6 +122,10 @@ def open_api_3_0_1_schema_path
|
|
115
122
|
"./test/data/openapi3/3_0_1.yaml"
|
116
123
|
end
|
117
124
|
|
125
|
+
def open_api_3_1_schema_path
|
126
|
+
"./test/data/openapi3/3_1.yaml"
|
127
|
+
end
|
128
|
+
|
118
129
|
def open_api_3_invalid_reference_path
|
119
130
|
"./test/data/openapi3/invalid_reference.yaml"
|
120
131
|
end
|
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: 5.
|
4
|
+
version: 5.3.0
|
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: 2024-
|
13
|
+
date: 2024-05-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json_schema
|
@@ -94,28 +94,14 @@ dependencies:
|
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '
|
97
|
+
version: '13.1'
|
98
98
|
type: :development
|
99
99
|
prerelease: false
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: '
|
105
|
-
- !ruby/object:Gem::Dependency
|
106
|
-
name: rr
|
107
|
-
requirement: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - "~>"
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '1.1'
|
112
|
-
type: :development
|
113
|
-
prerelease: false
|
114
|
-
version_requirements: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - "~>"
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '1.1'
|
104
|
+
version: '13.1'
|
119
105
|
- !ruby/object:Gem::Dependency
|
120
106
|
name: pry
|
121
107
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,20 +132,6 @@ dependencies:
|
|
146
132
|
version: '0'
|
147
133
|
- !ruby/object:Gem::Dependency
|
148
134
|
name: rubocop
|
149
|
-
requirement: !ruby/object:Gem::Requirement
|
150
|
-
requirements:
|
151
|
-
- - "<"
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
version: 1.13.0
|
154
|
-
type: :development
|
155
|
-
prerelease: false
|
156
|
-
version_requirements: !ruby/object:Gem::Requirement
|
157
|
-
requirements:
|
158
|
-
- - "<"
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
version: 1.13.0
|
161
|
-
- !ruby/object:Gem::Dependency
|
162
|
-
name: rubocop-performance
|
163
135
|
requirement: !ruby/object:Gem::Requirement
|
164
136
|
requirements:
|
165
137
|
- - ">="
|
@@ -173,21 +145,7 @@ dependencies:
|
|
173
145
|
- !ruby/object:Gem::Version
|
174
146
|
version: '0'
|
175
147
|
- !ruby/object:Gem::Dependency
|
176
|
-
name: rubocop-
|
177
|
-
requirement: !ruby/object:Gem::Requirement
|
178
|
-
requirements:
|
179
|
-
- - ">="
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: '0'
|
182
|
-
type: :development
|
183
|
-
prerelease: false
|
184
|
-
version_requirements: !ruby/object:Gem::Requirement
|
185
|
-
requirements:
|
186
|
-
- - ">="
|
187
|
-
- !ruby/object:Gem::Version
|
188
|
-
version: '0'
|
189
|
-
- !ruby/object:Gem::Dependency
|
190
|
-
name: rubocop-rake
|
148
|
+
name: rubocop-performance
|
191
149
|
requirement: !ruby/object:Gem::Requirement
|
192
150
|
requirements:
|
193
151
|
- - ">="
|
@@ -305,7 +263,11 @@ files:
|
|
305
263
|
homepage: https://github.com/interagent/committee
|
306
264
|
licenses:
|
307
265
|
- MIT
|
308
|
-
metadata:
|
266
|
+
metadata:
|
267
|
+
bug_tracker_uri: https://github.com/interagent/committee/issues
|
268
|
+
changelog_uri: https://github.com/interagent/committee/blob/master/CHANGELOG.md
|
269
|
+
rubygems_mfa_required: 'true'
|
270
|
+
source_code_uri: https://github.com/interagent/committee
|
309
271
|
post_install_message:
|
310
272
|
rdoc_options: []
|
311
273
|
require_paths:
|
@@ -314,14 +276,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
314
276
|
requirements:
|
315
277
|
- - ">="
|
316
278
|
- !ruby/object:Gem::Version
|
317
|
-
version: 2.
|
279
|
+
version: 2.7.0
|
318
280
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
319
281
|
requirements:
|
320
282
|
- - ">="
|
321
283
|
- !ruby/object:Gem::Version
|
322
284
|
version: '0'
|
323
285
|
requirements: []
|
324
|
-
rubygems_version: 3.
|
286
|
+
rubygems_version: 3.5.3
|
325
287
|
signing_key:
|
326
288
|
specification_version: 4
|
327
289
|
summary: A collection of Rack middleware to support JSON Schema.
|