openapi_first 0.12.0 → 0.12.1
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/benchmarks/Gemfile.lock +3 -3
- data/lib/openapi_first/response_validation.rb +6 -0
- data/lib/openapi_first/router.rb +1 -1
- data/lib/openapi_first/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6968ab6df070c86d592d8d09bdc68d637287adf0cf090eac5b6f35cddbc918f8
|
4
|
+
data.tar.gz: 6d41f5d082f8f5882fa2c57fe509bc54aae6d3b9ef6c3d16cd41340c6d58d1c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76f33d42b144e17b291883c8994562f79db35e9e575e098acb49434a2fe4142975781f31297bd9833d309cde8da87d4f59d873290487cb5bb4224c49306fca0e
|
7
|
+
data.tar.gz: 7aad49f9f315e923205c96b92166553a43d29bb5a45fcab4a359a72fd7484536c8099f22dafea5a973aac427aaebf3b37f7832dd0f28af9bc1e39d4aafb9bb6f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.12.1
|
4
|
+
- Fix response when handler returns 404 or 405
|
5
|
+
- Don't validate the response content if status is 205 (no content)
|
6
|
+
|
3
7
|
## 0.12.0
|
4
8
|
- Change `ResponseValidator` to raise an exception if it found a problem
|
5
9
|
- Params have symbolized keys now
|
data/Gemfile.lock
CHANGED
data/benchmarks/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
openapi_first (0.12.
|
4
|
+
openapi_first (0.12.1)
|
5
5
|
deep_merge (>= 1.2.1)
|
6
6
|
hanami-router (~> 2.0.alpha3)
|
7
7
|
hanami-utils (~> 2.0.alpha1)
|
@@ -74,7 +74,7 @@ GEM
|
|
74
74
|
hash-deep-merge (0.1.1)
|
75
75
|
i18n (1.8.3)
|
76
76
|
concurrent-ruby (~> 1.0)
|
77
|
-
json_schema (0.20.
|
77
|
+
json_schema (0.20.9)
|
78
78
|
json_schemer (0.2.11)
|
79
79
|
ecma-re-validator (~> 0.2)
|
80
80
|
hana (~> 1.3)
|
@@ -103,7 +103,7 @@ GEM
|
|
103
103
|
nokogiri
|
104
104
|
openapi_parser (0.11.2)
|
105
105
|
public_suffix (4.0.5)
|
106
|
-
rack (2.2.
|
106
|
+
rack (2.2.3)
|
107
107
|
rack-accept (0.4.5)
|
108
108
|
rack (>= 0.4)
|
109
109
|
rack-protection (2.0.8.1)
|
@@ -24,6 +24,8 @@ module OpenapiFirst
|
|
24
24
|
|
25
25
|
def validate(response, operation)
|
26
26
|
status, headers, body = response.to_a
|
27
|
+
return validate_status_only(operation, status) if status == 204
|
28
|
+
|
27
29
|
content_type = headers[Rack::CONTENT_TYPE]
|
28
30
|
raise ResponseInvalid, "Response has no content-type for '#{operation.name}'" unless content_type
|
29
31
|
|
@@ -33,6 +35,10 @@ module OpenapiFirst
|
|
33
35
|
|
34
36
|
private
|
35
37
|
|
38
|
+
def validate_status_only(operation, status)
|
39
|
+
operation.response_for(status)
|
40
|
+
end
|
41
|
+
|
36
42
|
def validate_response_body(schema, response)
|
37
43
|
full_body = +''
|
38
44
|
response.each { |chunk| full_body << chunk }
|
data/lib/openapi_first/router.rb
CHANGED
@@ -23,7 +23,7 @@ module OpenapiFirst
|
|
23
23
|
env[OPERATION] = nil
|
24
24
|
response = call_router(env)
|
25
25
|
status = response[0]
|
26
|
-
if UNKNOWN_ROUTE_STATUS.include?(status)
|
26
|
+
if UNKNOWN_ROUTE_STATUS.include?(status) && env[OPERATION].nil?
|
27
27
|
return @parent_app.call(env) if @parent_app # This should only happen if used via OpenapiFirst.middlware
|
28
28
|
|
29
29
|
raise_error(env) if @raise
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openapi_first
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Haller
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deep_merge
|