openapi_first 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '03752095ad50ff4a6142b3f716f00aba532191a12f700227eca0d2d3c9c7a6b1'
4
- data.tar.gz: 7c0271d081181b18999ce75dc72ee9fa4677eb18fc0ee02ed1a40505da9aa072
3
+ metadata.gz: 6968ab6df070c86d592d8d09bdc68d637287adf0cf090eac5b6f35cddbc918f8
4
+ data.tar.gz: 6d41f5d082f8f5882fa2c57fe509bc54aae6d3b9ef6c3d16cd41340c6d58d1c6
5
5
  SHA512:
6
- metadata.gz: f7a2454ed16c69e7d0b32f610ed985640735bba36a1e28798319b501f3f1eb80bb14b8329c8794f0dd87e3d38db037210319e3e25f82b1b5e0110f63c24ea4d3
7
- data.tar.gz: 479eedd62e341f834ed258504d2699a94cfa924301ae85a016d075c56df870041e3b0504829bbce456694e138f7598129c20684731257ff6be23d5dba4b9b2f8
6
+ metadata.gz: 76f33d42b144e17b291883c8994562f79db35e9e575e098acb49434a2fe4142975781f31297bd9833d309cde8da87d4f59d873290487cb5bb4224c49306fca0e
7
+ data.tar.gz: 7aad49f9f315e923205c96b92166553a43d29bb5a45fcab4a359a72fd7484536c8099f22dafea5a973aac427aaebf3b37f7832dd0f28af9bc1e39d4aafb9bb6f
@@ -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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openapi_first (0.12.0)
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)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- openapi_first (0.12.0)
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.8)
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.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 }
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenapiFirst
4
- VERSION = '0.12.0'
4
+ VERSION = '0.12.1'
5
5
  end
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.0
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-13 00:00:00.000000000 Z
11
+ date: 2020-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge