committee 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/committee/drivers/open_api_2.rb +1 -1
- data/test/drivers/open_api_2_test.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c8e99f5723f1c9143ba87285e7011b092b47b61
|
4
|
+
data.tar.gz: f4147937e34d9c26a7b69b10ca6a3858bf88f744
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8565f9b376b49f2e03b2836ebc468ce516dab760a5119d05f44327ea5cedadb61a69fc88f3a6a2a32ef8fd1aee8087f69c9bc91eb8f210e79b7d297d47175b29
|
7
|
+
data.tar.gz: cb1beb0528a5f4de978cd5cdf8efe488d18d550ebeaa348ebd88e427863b6e53e14379f2c72860097fb989b76b5230dc191712161eb44ab9dd5a04fec428ddb2
|
@@ -229,7 +229,7 @@ module Committee::Drivers
|
|
229
229
|
# Sort responses so that we can try to prefer any 3-digit status code.
|
230
230
|
# If there are none, we'll just take anything from the list.
|
231
231
|
ordered_responses = link_data["responses"].
|
232
|
-
select { |k, v| k =~ /[0-9]{3}/ }
|
232
|
+
select { |k, v| k.to_s =~ /[0-9]{3}/ }
|
233
233
|
if first = ordered_responses.first
|
234
234
|
[first[0].to_i, first[1]]
|
235
235
|
else
|
@@ -84,6 +84,18 @@ describe Committee::Drivers::OpenAPI2 do
|
|
84
84
|
assert_equal({ 'description' => '302 response' }, link.target_schema.data)
|
85
85
|
end
|
86
86
|
|
87
|
+
it "prefers any numeric three-digit response next" do
|
88
|
+
schema_data = schema_data_with_responses({
|
89
|
+
'default' => { 'schema' => { 'description' => 'default response' } },
|
90
|
+
302 => { 'schema' => { 'description' => '302 response' } },
|
91
|
+
})
|
92
|
+
|
93
|
+
schema = @driver.parse(schema_data)
|
94
|
+
link = schema.routes['GET'][0][1]
|
95
|
+
assert_equal 302, link.status_success
|
96
|
+
assert_equal({ 'description' => '302 response' }, link.target_schema.data)
|
97
|
+
end
|
98
|
+
|
87
99
|
it "falls back to no response" do
|
88
100
|
schema_data = schema_data_with_responses({})
|
89
101
|
|
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: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandur
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-09-
|
12
|
+
date: 2018-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_schema
|