committee 4.3.0 → 4.99.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/committee/drivers/hyper_schema/schema.rb +2 -2
  3. data/lib/committee/drivers/open_api_2/driver.rb +0 -1
  4. data/lib/committee/drivers/open_api_2/schema.rb +2 -2
  5. data/lib/committee/drivers/open_api_3/schema.rb +2 -2
  6. data/lib/committee/drivers/schema.rb +1 -1
  7. data/lib/committee/middleware/base.rb +1 -1
  8. data/lib/committee/middleware/request_validation.rb +0 -3
  9. data/lib/committee/middleware/response_validation.rb +4 -0
  10. data/lib/committee/request_unpacker.rb +46 -60
  11. data/lib/committee/schema_validator/hyper_schema.rb +33 -26
  12. data/lib/committee/schema_validator/open_api_3.rb +34 -20
  13. data/lib/committee/schema_validator/option.rb +26 -5
  14. data/lib/committee/test/methods.rb +11 -4
  15. data/lib/committee/utils.rb +28 -0
  16. data/lib/committee.rb +1 -0
  17. data/test/drivers_test.rb +1 -1
  18. data/test/middleware/request_validation_open_api_3_test.rb +149 -6
  19. data/test/middleware/request_validation_test.rb +13 -0
  20. data/test/middleware/response_validation_open_api_3_test.rb +2 -2
  21. data/test/middleware/response_validation_test.rb +8 -0
  22. data/test/request_unpacker_test.rb +35 -123
  23. data/test/schema_validator/hyper_schema/router_test.rb +2 -2
  24. data/test/schema_validator/open_api_3/operation_wrapper_test.rb +3 -3
  25. data/test/schema_validator/open_api_3/request_validator_test.rb +0 -3
  26. data/test/schema_validator/open_api_3/response_validator_test.rb +1 -1
  27. data/test/test/methods_new_version_test.rb +13 -4
  28. data/test/test/methods_test.rb +6 -4
  29. data/test/test_helper.rb +13 -1
  30. metadata +45 -10
@@ -46,14 +46,14 @@ describe Committee::Test::Methods do
46
46
  it "passes through a valid response" do
47
47
  @app = new_rack_app(JSON.generate([ValidApp]))
48
48
  get "/apps"
49
- assert_schema_conform
49
+ assert_schema_conform(200)
50
50
  end
51
51
 
52
52
  it "detects an invalid response Content-Type" do
53
53
  @app = new_rack_app(JSON.generate([ValidApp]), {})
54
54
  get "/apps"
55
55
  e = assert_raises(Committee::InvalidResponse) do
56
- assert_schema_conform
56
+ assert_schema_conform(200)
57
57
  end
58
58
  assert_match(/response header must be set to/i, e.message)
59
59
  end
@@ -64,7 +64,8 @@ describe Committee::Test::Methods do
64
64
  _, err = capture_io do
65
65
  assert_schema_conform
66
66
  end
67
- assert_match(/\[DEPRECATION\]/i, err)
67
+ assert_match(/\[DEPRECATION\] Now assert_schema_conform check response schema only/i, err)
68
+ assert_match(/\[DEPRECATION\] Pass expected response status code/i, err)
68
69
  end
69
70
  end
70
71
 
@@ -161,7 +162,8 @@ describe Committee::Test::Methods do
161
162
  _, err = capture_io do
162
163
  assert_schema_conform
163
164
  end
164
- assert_match(/\[DEPRECATION\]/i, err)
165
+ assert_match(/\[DEPRECATION\] Now assert_schema_conform check response schema only/i, err)
166
+ assert_match(/\[DEPRECATION\] Pass expected response status code/i, err)
165
167
  end
166
168
  end
167
169
 
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"
@@ -55,6 +55,10 @@ def open_api_2_schema
55
55
  @open_api_2_schema ||= Committee::Drivers.load_from_file(open_api_2_schema_path)
56
56
  end
57
57
 
58
+ def open_api_2_form_schema
59
+ @open_api_2_form_schema ||= Committee::Drivers.load_from_file(open_api_2_form_schema_path)
60
+ end
61
+
58
62
  def open_api_3_schema
59
63
  @open_api_3_schema ||= Committee::Drivers.load_from_file(open_api_3_schema_path)
60
64
  end
@@ -73,6 +77,10 @@ def open_api_2_data
73
77
  JSON.parse(File.read(open_api_2_schema_path))
74
78
  end
75
79
 
80
+ def open_api_2_form_data
81
+ JSON.parse(File.read(open_api_2_form_schema_path))
82
+ end
83
+
76
84
  def open_api_3_data
77
85
  YAML.load_file(open_api_3_schema_path)
78
86
  end
@@ -85,6 +93,10 @@ def open_api_2_schema_path
85
93
  "./test/data/openapi2/petstore-expanded.json"
86
94
  end
87
95
 
96
+ def open_api_2_form_schema_path
97
+ "./test/data/openapi2/petstore-expanded-form.json"
98
+ end
99
+
88
100
  def open_api_3_schema_path
89
101
  "./test/data/openapi3/normal.yaml"
90
102
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: committee
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.99.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur
8
8
  - geemus (Wesley Beary)
9
9
  - ota42y
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-12-23 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
@@ -53,6 +53,9 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: 0.11.1
56
+ - - "<"
57
+ - !ruby/object:Gem::Version
58
+ version: '1.0'
56
59
  type: :runtime
57
60
  prerelease: false
58
61
  version_requirements: !ruby/object:Gem::Requirement
@@ -60,6 +63,9 @@ dependencies:
60
63
  - - ">="
61
64
  - !ruby/object:Gem::Version
62
65
  version: 0.11.1
66
+ - - "<"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
63
69
  - !ruby/object:Gem::Dependency
64
70
  name: minitest
65
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,14 +86,14 @@ dependencies:
80
86
  requirements:
81
87
  - - "~>"
82
88
  - !ruby/object:Gem::Version
83
- version: '0.6'
89
+ version: '0.8'
84
90
  type: :development
85
91
  prerelease: false
86
92
  version_requirements: !ruby/object:Gem::Requirement
87
93
  requirements:
88
94
  - - "~>"
89
95
  - !ruby/object:Gem::Version
90
- version: '0.6'
96
+ version: '0.8'
91
97
  - !ruby/object:Gem::Dependency
92
98
  name: rake
93
99
  requirement: !ruby/object:Gem::Requirement
@@ -146,6 +152,20 @@ dependencies:
146
152
  version: '0'
147
153
  - !ruby/object:Gem::Dependency
148
154
  name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "<"
158
+ - !ruby/object:Gem::Version
159
+ version: 1.13.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "<"
165
+ - !ruby/object:Gem::Version
166
+ version: 1.13.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: rubocop-performance
149
169
  requirement: !ruby/object:Gem::Requirement
150
170
  requirements:
151
171
  - - ">="
@@ -159,7 +179,21 @@ dependencies:
159
179
  - !ruby/object:Gem::Version
160
180
  version: '0'
161
181
  - !ruby/object:Gem::Dependency
162
- name: rubocop-performance
182
+ name: rubocop-minitest
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: rubocop-rake
163
197
  requirement: !ruby/object:Gem::Requirement
164
198
  requirements:
165
199
  - - ">="
@@ -186,7 +220,7 @@ dependencies:
186
220
  - - ">="
187
221
  - !ruby/object:Gem::Version
188
222
  version: '0'
189
- description:
223
+ description:
190
224
  email:
191
225
  - brandur@mutelight.org
192
226
  - geemus+github@gmail.com
@@ -239,6 +273,7 @@ files:
239
273
  - lib/committee/schema_validator/option.rb
240
274
  - lib/committee/test/methods.rb
241
275
  - lib/committee/test/schema_coverage.rb
276
+ - lib/committee/utils.rb
242
277
  - lib/committee/validation_error.rb
243
278
  - test/bin/committee_stub_test.rb
244
279
  - test/bin_test.rb
@@ -276,7 +311,7 @@ homepage: https://github.com/interagent/committee
276
311
  licenses:
277
312
  - MIT
278
313
  metadata: {}
279
- post_install_message:
314
+ post_install_message:
280
315
  rdoc_options: []
281
316
  require_paths:
282
317
  - lib
@@ -291,8 +326,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
326
  - !ruby/object:Gem::Version
292
327
  version: '0'
293
328
  requirements: []
294
- rubygems_version: 3.1.2
295
- signing_key:
329
+ rubygems_version: 3.3.3
330
+ signing_key:
296
331
  specification_version: 4
297
332
  summary: A collection of Rack middleware to support JSON Schema.
298
333
  test_files: []