committee 5.5.0 → 5.5.2
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/bin/committee_stub.rb +1 -6
- data/lib/committee/drivers/open_api_2/driver.rb +21 -33
- data/lib/committee/drivers/open_api_2/link.rb +8 -1
- data/lib/committee/drivers/open_api_2/parameter_schema_builder.rb +1 -2
- data/lib/committee/drivers/open_api_2/schema_builder.rb +2 -5
- data/lib/committee/drivers.rb +1 -1
- data/lib/committee/errors.rb +2 -2
- data/lib/committee/middleware/base.rb +2 -2
- data/lib/committee/middleware/request_validation.rb +1 -1
- data/lib/committee/middleware/stub.rb +1 -1
- data/lib/committee/request_unpacker.rb +17 -9
- data/lib/committee/schema_validator/hyper_schema/parameter_coercer.rb +41 -41
- data/lib/committee/schema_validator/hyper_schema/request_validator.rb +1 -2
- data/lib/committee/schema_validator/hyper_schema/response_validator.rb +15 -7
- data/lib/committee/schema_validator/hyper_schema/string_params_coercer.rb +60 -60
- data/lib/committee/schema_validator/hyper_schema.rb +65 -59
- data/lib/committee/schema_validator/open_api_3/request_validator.rb +1 -1
- data/lib/committee/schema_validator/open_api_3.rb +11 -5
- data/lib/committee/schema_validator/option.rb +3 -6
- data/lib/committee/test/schema_coverage.rb +1 -7
- data/lib/committee/utils.rb +20 -20
- data/lib/committee/version.rb +1 -1
- data/test/bin/committee_stub_test.rb +1 -5
- data/test/committee_test.rb +0 -1
- data/test/drivers/hyper_schema/driver_test.rb +0 -1
- data/test/drivers/open_api_2/driver_test.rb +1 -3
- data/test/drivers/open_api_2/header_schema_builder_test.rb +1 -9
- data/test/drivers/open_api_2/link_test.rb +1 -2
- data/test/drivers/open_api_2/parameter_schema_builder_test.rb +6 -45
- data/test/drivers/open_api_3/driver_test.rb +5 -5
- data/test/drivers_test.rb +19 -28
- data/test/middleware/base_test.rb +13 -36
- data/test/middleware/request_validation_open_api_3_test.rb +24 -47
- data/test/middleware/request_validation_test.rb +19 -53
- data/test/middleware/response_validation_open_api_3_test.rb +33 -25
- data/test/middleware/response_validation_test.rb +24 -15
- data/test/middleware/stub_test.rb +5 -12
- data/test/request_unpacker_test.rb +26 -66
- data/test/schema_validator/hyper_schema/parameter_coercer_test.rb +3 -3
- data/test/schema_validator/hyper_schema/request_validator_test.rb +7 -17
- data/test/schema_validator/hyper_schema/response_generator_test.rb +24 -18
- data/test/schema_validator/hyper_schema/response_validator_test.rb +3 -7
- data/test/schema_validator/hyper_schema/string_params_coercer_test.rb +2 -2
- data/test/schema_validator/open_api_3/operation_wrapper_test.rb +16 -17
- data/test/schema_validator/open_api_3/request_validator_test.rb +8 -19
- data/test/schema_validator/open_api_3/response_validator_test.rb +2 -4
- data/test/test/methods_new_version_test.rb +2 -2
- data/test/test/methods_test.rb +5 -5
- data/test/test/schema_coverage_test.rb +4 -17
- data/test/test_helper.rb +6 -13
- data/test/validation_error_test.rb +1 -5
- metadata +3 -17
@@ -52,7 +52,7 @@ describe Committee::SchemaValidator::OpenAPI3::OperationWrapper do
|
|
52
52
|
|
53
53
|
it 'invalid params' do
|
54
54
|
e = assert_raises(Committee::InvalidRequest) {
|
55
|
-
operation_object.validate_request_params({}, {}, {"string" => 1}, HEADER, @validator_option)
|
55
|
+
operation_object.validate_request_params({}, {}, { "string" => 1 }, HEADER, @validator_option)
|
56
56
|
}
|
57
57
|
|
58
58
|
assert_match(/expected string, but received Integer: 1/i, e.message)
|
@@ -61,10 +61,10 @@ describe Committee::SchemaValidator::OpenAPI3::OperationWrapper do
|
|
61
61
|
|
62
62
|
it 'support put method' do
|
63
63
|
@method = "put"
|
64
|
-
operation_object.validate_request_params({}, {}, {"string" => "str"}, HEADER, @validator_option)
|
64
|
+
operation_object.validate_request_params({}, {}, { "string" => "str" }, HEADER, @validator_option)
|
65
65
|
|
66
66
|
e = assert_raises(Committee::InvalidRequest) {
|
67
|
-
operation_object.validate_request_params({}, {}, {"string" => 1}, HEADER, @validator_option)
|
67
|
+
operation_object.validate_request_params({}, {}, { "string" => 1 }, HEADER, @validator_option)
|
68
68
|
}
|
69
69
|
|
70
70
|
assert_match(/expected string, but received Integer: 1/i, e.message)
|
@@ -73,10 +73,10 @@ describe Committee::SchemaValidator::OpenAPI3::OperationWrapper do
|
|
73
73
|
|
74
74
|
it 'support patch method' do
|
75
75
|
@method = "patch"
|
76
|
-
operation_object.validate_request_params({}, {}, {"integer" => 1}, HEADER, @validator_option)
|
76
|
+
operation_object.validate_request_params({}, {}, { "integer" => 1 }, HEADER, @validator_option)
|
77
77
|
|
78
78
|
e = assert_raises(Committee::InvalidRequest) {
|
79
|
-
operation_object.validate_request_params({}, {}, {"integer" => "str"}, HEADER, @validator_option)
|
79
|
+
operation_object.validate_request_params({}, {}, { "integer" => "str" }, HEADER, @validator_option)
|
80
80
|
}
|
81
81
|
|
82
82
|
assert_match(/expected integer, but received String: "str"/i, e.message)
|
@@ -84,7 +84,7 @@ describe Committee::SchemaValidator::OpenAPI3::OperationWrapper do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'unknown param' do
|
87
|
-
operation_object.validate_request_params({}, {}, {"unknown" => 1}, HEADER, @validator_option)
|
87
|
+
operation_object.validate_request_params({}, {}, { "unknown" => 1 }, HEADER, @validator_option)
|
88
88
|
end
|
89
89
|
|
90
90
|
describe 'support get method' do
|
@@ -95,7 +95,7 @@ describe Committee::SchemaValidator::OpenAPI3::OperationWrapper do
|
|
95
95
|
it 'correct' do
|
96
96
|
operation_object.validate_request_params(
|
97
97
|
{},
|
98
|
-
{"query_string" => "query", "query_integer_list" => [1, 2]},
|
98
|
+
{ "query_string" => "query", "query_integer_list" => [1, 2] },
|
99
99
|
{},
|
100
100
|
HEADER,
|
101
101
|
@validator_option
|
@@ -103,7 +103,7 @@ describe Committee::SchemaValidator::OpenAPI3::OperationWrapper do
|
|
103
103
|
|
104
104
|
operation_object.validate_request_params(
|
105
105
|
{},
|
106
|
-
{"query_string" => "query", "query_integer_list" => [1, 2], "optional_integer" => 1},
|
106
|
+
{ "query_string" => "query", "query_integer_list" => [1, 2], "optional_integer" => 1 },
|
107
107
|
{},
|
108
108
|
HEADER,
|
109
109
|
@validator_option
|
@@ -114,7 +114,7 @@ describe Committee::SchemaValidator::OpenAPI3::OperationWrapper do
|
|
114
114
|
|
115
115
|
it 'not exist required' do
|
116
116
|
e = assert_raises(Committee::InvalidRequest) {
|
117
|
-
operation_object.validate_request_params({}, {"query_integer_list" => [1, 2]}, {}, HEADER, @validator_option)
|
117
|
+
operation_object.validate_request_params({}, { "query_integer_list" => [1, 2] }, {}, HEADER, @validator_option)
|
118
118
|
}
|
119
119
|
|
120
120
|
assert_match(/missing required parameters: query_string/i, e.message)
|
@@ -125,7 +125,7 @@ describe Committee::SchemaValidator::OpenAPI3::OperationWrapper do
|
|
125
125
|
e = assert_raises(Committee::InvalidRequest) {
|
126
126
|
operation_object.validate_request_params(
|
127
127
|
{},
|
128
|
-
{"query_string" => 1, "query_integer_list" => [1, 2], "optional_integer" => 1},
|
128
|
+
{ "query_string" => 1, "query_integer_list" => [1, 2], "optional_integer" => 1 },
|
129
129
|
{},
|
130
130
|
HEADER,
|
131
131
|
@validator_option
|
@@ -144,14 +144,14 @@ describe Committee::SchemaValidator::OpenAPI3::OperationWrapper do
|
|
144
144
|
end
|
145
145
|
|
146
146
|
it 'correct' do
|
147
|
-
operation_object.validate_request_params({}, {"limit" => "1"}, {}, HEADER, @validator_option)
|
147
|
+
operation_object.validate_request_params({}, { "limit" => "1" }, {}, HEADER, @validator_option)
|
148
148
|
|
149
149
|
assert true
|
150
150
|
end
|
151
151
|
|
152
152
|
it 'invalid type' do
|
153
153
|
e = assert_raises(Committee::InvalidRequest) {
|
154
|
-
operation_object.validate_request_params({}, {"limit" => "a"}, {}, HEADER, @validator_option)
|
154
|
+
operation_object.validate_request_params({}, { "limit" => "a" }, {}, HEADER, @validator_option)
|
155
155
|
}
|
156
156
|
|
157
157
|
assert_match(/expected integer, but received String: "a"/i, e.message)
|
@@ -166,14 +166,14 @@ describe Committee::SchemaValidator::OpenAPI3::OperationWrapper do
|
|
166
166
|
end
|
167
167
|
|
168
168
|
it 'correct' do
|
169
|
-
operation_object.validate_request_params({}, {"limit" => "1"}, {}, HEADER, @validator_option)
|
169
|
+
operation_object.validate_request_params({}, { "limit" => "1" }, {}, HEADER, @validator_option)
|
170
170
|
|
171
171
|
assert true
|
172
172
|
end
|
173
173
|
|
174
174
|
it 'invalid type' do
|
175
175
|
e = assert_raises(Committee::InvalidRequest) {
|
176
|
-
operation_object.validate_request_params({}, {"limit" => "a"}, {}, HEADER, @validator_option)
|
176
|
+
operation_object.validate_request_params({}, { "limit" => "a" }, {}, HEADER, @validator_option)
|
177
177
|
}
|
178
178
|
|
179
179
|
assert_match(/expected integer, but received String: "a"/i, e.message)
|
@@ -183,17 +183,16 @@ describe Committee::SchemaValidator::OpenAPI3::OperationWrapper do
|
|
183
183
|
|
184
184
|
it 'support options method' do
|
185
185
|
@method = "options"
|
186
|
-
operation_object.validate_request_params({}, {}, {"integer" => 1}, HEADER, @validator_option)
|
186
|
+
operation_object.validate_request_params({}, {}, { "integer" => 1 }, HEADER, @validator_option)
|
187
187
|
|
188
188
|
e = assert_raises(Committee::InvalidRequest) {
|
189
|
-
operation_object.validate_request_params({}, {}, {"integer" => "str"}, HEADER, @validator_option)
|
189
|
+
operation_object.validate_request_params({}, {}, { "integer" => "str" }, HEADER, @validator_option)
|
190
190
|
}
|
191
191
|
|
192
192
|
assert_match(/expected integer, but received String: "str"/i, e.message)
|
193
193
|
assert_kind_of(OpenAPIParser::OpenAPIError, e.original_error)
|
194
194
|
end
|
195
195
|
|
196
|
-
|
197
196
|
describe '#content_types' do
|
198
197
|
it 'returns supported content types' do
|
199
198
|
@path = '/validate_content_types'
|
@@ -20,16 +20,13 @@ describe Committee::SchemaValidator::OpenAPI3::RequestValidator do
|
|
20
20
|
|
21
21
|
it "optionally content_type check" do
|
22
22
|
@app = new_rack_app(check_content_type: true, schema: open_api_3_schema)
|
23
|
-
params = {
|
24
|
-
"string_post_1" => "cloudnasium"
|
25
|
-
}
|
23
|
+
params = { "string_post_1" => "cloudnasium" }
|
26
24
|
header "Content-Type", "text/html"
|
27
25
|
post "/characters", JSON.generate(params)
|
28
26
|
assert_equal 400, last_response.status
|
29
27
|
|
30
28
|
body = JSON.parse(last_response.body)
|
31
|
-
message =
|
32
|
-
%{"Content-Type" request header must be set to "application/json".}
|
29
|
+
message = %{"Content-Type" request header must be set to "application/json".}
|
33
30
|
|
34
31
|
assert_equal "bad_request", body['id']
|
35
32
|
assert_equal message, body['message']
|
@@ -37,9 +34,7 @@ describe Committee::SchemaValidator::OpenAPI3::RequestValidator do
|
|
37
34
|
|
38
35
|
it "validates content_type" do
|
39
36
|
@app = new_rack_app(check_content_type: true, schema: open_api_3_schema)
|
40
|
-
params = {
|
41
|
-
"string_post_1" => "cloudnasium"
|
42
|
-
}
|
37
|
+
params = { "string_post_1" => "cloudnasium" }
|
43
38
|
header "Content-Type", "text/html"
|
44
39
|
post "/validate_content_types", JSON.generate(params)
|
45
40
|
assert_equal 400, last_response.status
|
@@ -53,9 +48,7 @@ describe Committee::SchemaValidator::OpenAPI3::RequestValidator do
|
|
53
48
|
|
54
49
|
it "optionally skip content_type check" do
|
55
50
|
@app = new_rack_app(check_content_type: false, schema: open_api_3_schema)
|
56
|
-
params = {
|
57
|
-
"string_post_1" => "cloudnasium"
|
58
|
-
}
|
51
|
+
params = { "string_post_1" => "cloudnasium" }
|
59
52
|
header "Content-Type", "text/html"
|
60
53
|
post "/characters", JSON.generate(params)
|
61
54
|
assert_equal 200, last_response.status
|
@@ -63,9 +56,7 @@ describe Committee::SchemaValidator::OpenAPI3::RequestValidator do
|
|
63
56
|
|
64
57
|
it "if not exist requestBody definition, skip content_type check" do
|
65
58
|
@app = new_rack_app(check_content_type: true, schema: open_api_3_schema)
|
66
|
-
params = {
|
67
|
-
"string_post_1" => "cloudnasium"
|
68
|
-
}
|
59
|
+
params = { "string_post_1" => "cloudnasium" }
|
69
60
|
header "Content-Type", "application/json"
|
70
61
|
patch "/validate_no_parameter", JSON.generate(params)
|
71
62
|
assert_equal 200, last_response.status
|
@@ -77,12 +68,10 @@ describe Committee::SchemaValidator::OpenAPI3::RequestValidator do
|
|
77
68
|
patch "/validate_empty_optional_body"
|
78
69
|
assert_equal 200, last_response.status
|
79
70
|
end
|
80
|
-
|
71
|
+
|
81
72
|
it "does not mix up parameters and requestBody" do
|
82
73
|
@app = new_rack_app(check_content_type: true, schema: open_api_3_schema)
|
83
|
-
params = {
|
84
|
-
"last_name" => "Skywalker"
|
85
|
-
}
|
74
|
+
params = { "last_name" => "Skywalker" }
|
86
75
|
header "Content-Type", "application/json"
|
87
76
|
post "/additional_properties?first_name=Luke", JSON.generate(params)
|
88
77
|
assert_equal 200, last_response.status
|
@@ -93,7 +82,7 @@ describe Committee::SchemaValidator::OpenAPI3::RequestValidator do
|
|
93
82
|
header "Content-Type", "application/x-www-form-urlencoded"
|
94
83
|
patch "/validate_empty_optional_body", "{}"
|
95
84
|
assert_equal 400, last_response.status
|
96
|
-
end
|
85
|
+
end
|
97
86
|
|
98
87
|
it "validates content_type for option request" do
|
99
88
|
@app = new_rack_app(check_content_type: true, schema: open_api_3_schema)
|
@@ -5,10 +5,8 @@ require "test_helper"
|
|
5
5
|
describe Committee::SchemaValidator::OpenAPI3::ResponseValidator do
|
6
6
|
before do
|
7
7
|
@status = 200
|
8
|
-
@headers = {
|
9
|
-
|
10
|
-
}
|
11
|
-
@data = {"string" => "Honoka.Kousaka"}
|
8
|
+
@headers = { "Content-Type" => "application/json" }
|
9
|
+
@data = { "string" => "Honoka.Kousaka" }
|
12
10
|
|
13
11
|
@path = '/validate'
|
14
12
|
@method = 'post'
|
@@ -29,7 +29,7 @@ describe Committee::Test::Methods do
|
|
29
29
|
@committee_router = nil
|
30
30
|
@committee_schema = nil
|
31
31
|
|
32
|
-
@committee_options = {schema: hyper_schema}
|
32
|
+
@committee_options = { schema: hyper_schema }
|
33
33
|
end
|
34
34
|
|
35
35
|
describe "#assert_schema_conform" do
|
@@ -84,7 +84,7 @@ describe Committee::Test::Methods do
|
|
84
84
|
|
85
85
|
private
|
86
86
|
|
87
|
-
def new_rack_app(response, status=200, headers={ "Content-Type" => "application/json" })
|
87
|
+
def new_rack_app(response, status = 200, headers = { "Content-Type" => "application/json" })
|
88
88
|
Rack::Builder.new {
|
89
89
|
run lambda { |_|
|
90
90
|
[status, headers, [response]]
|
data/test/test/methods_test.rb
CHANGED
@@ -36,7 +36,7 @@ describe Committee::Test::Methods do
|
|
36
36
|
sc = JsonSchema.parse!(hyper_schema_data)
|
37
37
|
sc.expand_references!
|
38
38
|
s = Committee::Drivers::HyperSchema::Driver.new.parse(sc)
|
39
|
-
@committee_options.merge!({schema: s})
|
39
|
+
@committee_options.merge!({ schema: s })
|
40
40
|
end
|
41
41
|
|
42
42
|
describe "#assert_schema_conform" do
|
@@ -111,7 +111,7 @@ describe Committee::Test::Methods do
|
|
111
111
|
|
112
112
|
describe "OpenAPI3" do
|
113
113
|
before do
|
114
|
-
@committee_options.merge!({schema: open_api_3_schema})
|
114
|
+
@committee_options.merge!({ schema: open_api_3_schema })
|
115
115
|
|
116
116
|
@correct_response = { string_1: :honoka }
|
117
117
|
end
|
@@ -153,7 +153,7 @@ describe Committee::Test::Methods do
|
|
153
153
|
|
154
154
|
it "not exist required" do
|
155
155
|
@app = new_rack_app
|
156
|
-
get "/validate", {"query_string" => "query", "query_integer_list" => [1, 2]}
|
156
|
+
get "/validate", { "query_string" => "query", "query_integer_list" => [1, 2] }
|
157
157
|
e = assert_raises(Committee::InvalidRequest) do
|
158
158
|
assert_request_schema_confirm
|
159
159
|
end
|
@@ -208,7 +208,7 @@ describe Committee::Test::Methods do
|
|
208
208
|
end
|
209
209
|
|
210
210
|
it "raises error when path does not match prefix" do
|
211
|
-
@committee_options.merge!({prefix: '/api'})
|
211
|
+
@committee_options.merge!({ prefix: '/api' })
|
212
212
|
@app = new_rack_app(JSON.generate(@correct_response))
|
213
213
|
get "/characters"
|
214
214
|
e = assert_raises(Committee::InvalidResponse) do
|
@@ -350,7 +350,7 @@ describe Committee::Test::Methods do
|
|
350
350
|
|
351
351
|
private
|
352
352
|
|
353
|
-
def new_rack_app(response = nil, headers={ "Content-Type" => "application/json" }, status_code = 200)
|
353
|
+
def new_rack_app(response = nil, headers = { "Content-Type" => "application/json" }, status_code = 200)
|
354
354
|
Rack::Builder.new {
|
355
355
|
run lambda { |_|
|
356
356
|
[status_code, headers, [response]]
|
@@ -21,9 +21,7 @@ describe Committee::Test::SchemaCoverage do
|
|
21
21
|
end
|
22
22
|
it 'can record and report coverage properly' do
|
23
23
|
@schema_coverage.update_response_coverage!('/posts', 'get', '200')
|
24
|
-
assert_equal([
|
25
|
-
'/posts get 200',
|
26
|
-
], covered_responses)
|
24
|
+
assert_equal(['/posts get 200',], covered_responses)
|
27
25
|
assert_equal([
|
28
26
|
'/threads/{id} get 200',
|
29
27
|
'/posts get 404',
|
@@ -34,10 +32,7 @@ describe Committee::Test::SchemaCoverage do
|
|
34
32
|
], uncovered_responses)
|
35
33
|
|
36
34
|
@schema_coverage.update_response_coverage!('/likes', 'post', '200')
|
37
|
-
assert_equal([
|
38
|
-
'/posts get 200',
|
39
|
-
'/likes post 200',
|
40
|
-
], covered_responses)
|
35
|
+
assert_equal(['/posts get 200', '/likes post 200',], covered_responses)
|
41
36
|
assert_equal([
|
42
37
|
'/threads/{id} get 200',
|
43
38
|
'/posts get 404',
|
@@ -47,11 +42,7 @@ describe Committee::Test::SchemaCoverage do
|
|
47
42
|
], uncovered_responses)
|
48
43
|
|
49
44
|
@schema_coverage.update_response_coverage!('/likes', 'delete', '200')
|
50
|
-
assert_equal([
|
51
|
-
'/posts get 200',
|
52
|
-
'/likes post 200',
|
53
|
-
'/likes delete 200',
|
54
|
-
], covered_responses)
|
45
|
+
assert_equal(['/posts get 200', '/likes post 200', '/likes delete 200',], covered_responses)
|
55
46
|
assert_equal([
|
56
47
|
'/threads/{id} get 200',
|
57
48
|
'/posts get 404',
|
@@ -66,11 +57,7 @@ describe Committee::Test::SchemaCoverage do
|
|
66
57
|
'/likes post 200',
|
67
58
|
'/likes delete 200',
|
68
59
|
], covered_responses)
|
69
|
-
assert_equal([
|
70
|
-
'/threads/{id} get 200',
|
71
|
-
'/posts get 404',
|
72
|
-
'/posts post 200',
|
73
|
-
], uncovered_responses)
|
60
|
+
assert_equal(['/threads/{id} get 200', '/posts get 404', '/posts post 200',], uncovered_responses)
|
74
61
|
|
75
62
|
assert_equal({
|
76
63
|
'/threads/{id}' => {
|
data/test/test_helper.rb
CHANGED
@@ -21,7 +21,7 @@ require "minitest"
|
|
21
21
|
require "minitest/spec"
|
22
22
|
require "minitest/autorun"
|
23
23
|
require "rack/test"
|
24
|
-
require "
|
24
|
+
require "debug"
|
25
25
|
require "stringio"
|
26
26
|
|
27
27
|
require_relative "../lib/committee"
|
@@ -36,17 +36,10 @@ JsonSchema.configure do |c|
|
|
36
36
|
end
|
37
37
|
|
38
38
|
# For our hyper-schema example.
|
39
|
-
ValidApp = {
|
40
|
-
"maintenance" => false,
|
41
|
-
"name" => "example",
|
42
|
-
}.freeze
|
39
|
+
ValidApp = { "maintenance" => false, "name" => "example", }.freeze
|
43
40
|
|
44
41
|
# For our OpenAPI example.
|
45
|
-
ValidPet = {
|
46
|
-
"id" => 123,
|
47
|
-
"name" => "example",
|
48
|
-
"tag" => "tag-123",
|
49
|
-
}.freeze
|
42
|
+
ValidPet = { "id" => 123, "name" => "example", "tag" => "tag-123", }.freeze
|
50
43
|
|
51
44
|
def hyper_schema
|
52
45
|
@hyper_schema ||= Committee::Drivers.load_from_json(hyper_schema_schema_path)
|
@@ -61,11 +54,11 @@ def open_api_2_form_schema
|
|
61
54
|
end
|
62
55
|
|
63
56
|
def open_api_3_schema
|
64
|
-
@open_api_3_schema ||= Committee::Drivers.load_from_file(open_api_3_schema_path, parser_options:{strict_reference_validation: true})
|
57
|
+
@open_api_3_schema ||= Committee::Drivers.load_from_file(open_api_3_schema_path, parser_options: { strict_reference_validation: true })
|
65
58
|
end
|
66
59
|
|
67
60
|
def open_api_3_coverage_schema
|
68
|
-
@open_api_3_coverage_schema ||= Committee::Drivers.load_from_file(open_api_3_coverage_schema_path, parser_options:{strict_reference_validation: true})
|
61
|
+
@open_api_3_coverage_schema ||= Committee::Drivers.load_from_file(open_api_3_coverage_schema_path, parser_options: { strict_reference_validation: true })
|
69
62
|
end
|
70
63
|
|
71
64
|
# Don't cache this because we'll often manipulate the created hash in tests.
|
@@ -128,4 +121,4 @@ end
|
|
128
121
|
|
129
122
|
def open_api_3_invalid_reference_path
|
130
123
|
"./test/data/openapi3/invalid_reference.yaml"
|
131
|
-
end
|
124
|
+
end
|
@@ -14,11 +14,7 @@ describe Committee::ValidationError do
|
|
14
14
|
it "creates a Rack response object to render" do
|
15
15
|
body = { id: :bad_request, message: "Error" }
|
16
16
|
|
17
|
-
response = [
|
18
|
-
400,
|
19
|
-
{ "Content-Type" => "application/json" },
|
20
|
-
[JSON.generate(body)]
|
21
|
-
]
|
17
|
+
response = [400, { "Content-Type" => "application/json" }, [JSON.generate(body)]]
|
22
18
|
|
23
19
|
assert_equal @error.render, response
|
24
20
|
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.5.
|
4
|
+
version: 5.5.2
|
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:
|
13
|
+
date: 2025-03-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json_schema
|
@@ -109,21 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '13.1'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: pry-byebug
|
112
|
+
name: debug
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
115
|
- - ">="
|