openapi_first 0.12.1 → 0.12.2

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: 6968ab6df070c86d592d8d09bdc68d637287adf0cf090eac5b6f35cddbc918f8
4
- data.tar.gz: 6d41f5d082f8f5882fa2c57fe509bc54aae6d3b9ef6c3d16cd41340c6d58d1c6
3
+ metadata.gz: 689e572886b7ca556ffb00c89368195e129d954a03a3899f3d7d8401bd724196
4
+ data.tar.gz: e2669f12188188ac232d0c52b8a371e221ce65e589f2bd06dc6b7547fd0cafc2
5
5
  SHA512:
6
- metadata.gz: 76f33d42b144e17b291883c8994562f79db35e9e575e098acb49434a2fe4142975781f31297bd9833d309cde8da87d4f59d873290487cb5bb4224c49306fca0e
7
- data.tar.gz: 7aad49f9f315e923205c96b92166553a43d29bb5a45fcab4a359a72fd7484536c8099f22dafea5a973aac427aaebf3b37f7832dd0f28af9bc1e39d4aafb9bb6f
6
+ metadata.gz: c3409b992b56a09eb9e4bc75d20e6711a4ebda0bd93c0422316343ea48b4f8816394f1506b675c56e42f3dad339a0b7aa9c4834f0372045815a81888724ad45e
7
+ data.tar.gz: 2893535646d84f3ca6db6efc63c5334961929b9f6e561b8d36f771ca4ad0b9e25af5c5b06292ae9745610fa6dd229516c4aa4b42c01c52fc176294a1713b8767
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.2
4
+ - Allow response to have no media type object specified
5
+
3
6
  ## 0.12.1
4
7
  - Fix response when handler returns 404 or 405
5
8
  - Don't validate the response content if status is 205 (no content)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openapi_first (0.12.1)
4
+ openapi_first (0.12.2)
5
5
  deep_merge (>= 1.2.1)
6
6
  hanami-router (~> 2.0.alpha3)
7
7
  hanami-utils (~> 2.0.alpha1)
@@ -13,7 +13,7 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activesupport (6.0.3.1)
16
+ activesupport (6.0.3.2)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 0.7, < 2)
19
19
  minitest (~> 5.1)
@@ -26,7 +26,7 @@ GEM
26
26
  coderay (1.1.3)
27
27
  concurrent-ruby (1.1.6)
28
28
  deep_merge (1.2.1)
29
- diff-lcs (1.3)
29
+ diff-lcs (1.4.2)
30
30
  ecma-re-validator (0.2.1)
31
31
  regexp_parser (~> 1.2)
32
32
  hana (1.3.6)
@@ -57,7 +57,7 @@ GEM
57
57
  mustermann (= 1.1.1)
58
58
  nokogiri (1.10.9)
59
59
  mini_portile2 (~> 2.4.0)
60
- oas_parser (0.25.1)
60
+ oas_parser (0.25.2)
61
61
  activesupport (>= 4.0.0)
62
62
  addressable (~> 2.3)
63
63
  builder (~> 3.2.3)
@@ -65,14 +65,14 @@ GEM
65
65
  hash-deep-merge
66
66
  mustermann-contrib (~> 1.1.1)
67
67
  nokogiri
68
- parallel (1.19.1)
69
- parser (2.7.1.3)
70
- ast (~> 2.4.0)
68
+ parallel (1.19.2)
69
+ parser (2.7.1.4)
70
+ ast (~> 2.4.1)
71
71
  pry (0.13.1)
72
72
  coderay (~> 1.1)
73
73
  method_source (~> 1.0)
74
74
  public_suffix (4.0.5)
75
- rack (2.2.2)
75
+ rack (2.2.3)
76
76
  rack-test (1.1.0)
77
77
  rack (>= 1.0, < 3)
78
78
  rainbow (3.0.0)
@@ -92,13 +92,13 @@ GEM
92
92
  diff-lcs (>= 1.2.0, < 2.0)
93
93
  rspec-support (~> 3.9.0)
94
94
  rspec-support (3.9.3)
95
- rubocop (0.85.1)
95
+ rubocop (0.86.0)
96
96
  parallel (~> 1.10)
97
97
  parser (>= 2.7.0.1)
98
98
  rainbow (>= 2.2.2, < 4.0)
99
99
  regexp_parser (>= 1.7)
100
100
  rexml
101
- rubocop-ast (>= 0.0.3)
101
+ rubocop-ast (>= 0.0.3, < 1.0)
102
102
  ruby-progressbar (~> 1.7)
103
103
  unicode-display_width (>= 1.4.0, < 2.0)
104
104
  rubocop-ast (0.0.3)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- openapi_first (0.12.1)
4
+ openapi_first (0.12.2)
5
5
  deep_merge (>= 1.2.1)
6
6
  hanami-router (~> 2.0.alpha3)
7
7
  hanami-utils (~> 2.0.alpha1)
@@ -13,7 +13,7 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activesupport (6.0.3.1)
16
+ activesupport (6.0.3.2)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 0.7, < 2)
19
19
  minitest (~> 5.1)
@@ -31,7 +31,7 @@ GEM
31
31
  rack (>= 1.5)
32
32
  concurrent-ruby (1.1.6)
33
33
  deep_merge (1.2.1)
34
- dry-configurable (0.11.5)
34
+ dry-configurable (0.11.6)
35
35
  concurrent-ruby (~> 1.0)
36
36
  dry-core (~> 0.4, >= 0.4.7)
37
37
  dry-equalizer (~> 0.2)
@@ -93,7 +93,7 @@ GEM
93
93
  mustermann (>= 1.0.0)
94
94
  nokogiri (1.10.9)
95
95
  mini_portile2 (~> 2.4.0)
96
- oas_parser (0.25.1)
96
+ oas_parser (0.25.2)
97
97
  activesupport (>= 4.0.0)
98
98
  addressable (~> 2.3)
99
99
  builder (~> 3.2.3)
@@ -39,6 +39,8 @@ module OpenapiFirst
39
39
  content = response_for(status)['content']
40
40
  return if content.nil? || content.empty?
41
41
 
42
+ raise ResponseInvalid, "Response has no content-type for '#{name}'" unless content_type
43
+
42
44
  media_type = content[content_type]
43
45
  unless media_type
44
46
  message = "Response content type not found '#{content_type}' for '#{name}'"
@@ -27,8 +27,6 @@ module OpenapiFirst
27
27
  return validate_status_only(operation, status) if status == 204
28
28
 
29
29
  content_type = headers[Rack::CONTENT_TYPE]
30
- raise ResponseInvalid, "Response has no content-type for '#{operation.name}'" unless content_type
31
-
32
30
  response_schema = operation.response_schema_for(status, content_type)
33
31
  validate_response_body(response_schema, body) if response_schema
34
32
  end
@@ -22,8 +22,7 @@ module OpenapiFirst
22
22
  def call(env)
23
23
  env[OPERATION] = nil
24
24
  response = call_router(env)
25
- status = response[0]
26
- if UNKNOWN_ROUTE_STATUS.include?(status) && env[OPERATION].nil?
25
+ if env[OPERATION].nil?
27
26
  return @parent_app.call(env) if @parent_app # This should only happen if used via OpenapiFirst.middlware
28
27
 
29
28
  raise_error(env) if @raise
@@ -31,7 +30,6 @@ module OpenapiFirst
31
30
  response
32
31
  end
33
32
 
34
- UNKNOWN_ROUTE_STATUS = [404, 405].freeze
35
33
  ORIGINAL_PATH = 'openapi_first.path_info'
36
34
 
37
35
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenapiFirst
4
- VERSION = '0.12.1'
4
+ VERSION = '0.12.2'
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.1
4
+ version: 0.12.2
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-17 00:00:00.000000000 Z
11
+ date: 2020-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge