openapi_first 0.16.0.beta1 → 0.16.0

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: 5f46ad8751619914fa7b387ecb8a0178e67a7ba070e863321463f7ae1097e250
4
- data.tar.gz: 5961b6bff590f957a8908d62b3c87bd65438dbdfe055020c61739af2862b06cc
3
+ metadata.gz: ac3d5709b36ac797521a16ec11af5fe1106faf2aa2a48daf502516cc875fad47
4
+ data.tar.gz: 311e4b513cb5e655397e38cadfec1eff07ae70d1136c75197f87dba8b058073c
5
5
  SHA512:
6
- metadata.gz: 0e08b5d1b12f3379ef2f28ab98da925a43c7adc69ea617c305dedb06fbe63e7843cf0d861cd32d7942f7770b4f7ac9bb2762ffb179374fd15deff2b86f64899f
7
- data.tar.gz: ac406a2a868a44b8cfb8d54a71b5c4fb1d1078f666c6f3ee683a191c83c090a8312f59bd399e089edb4062d309ca98df02ee8b2078a445c1e3b16e5e19cfd462
6
+ metadata.gz: 85d40c11308a34a3f1a7c9886cf9826d5a36b6e9d8dc15f0a6bf9ae0d435b88f9e16576b339b0dc3b4e2a3c13bc00710fdbe6dd6bdabf1d8aa644f7f34f6cfd7
7
+ data.tar.gz: ce475547d199cfabd050e4bdcbf995cecd9a72480b9bfe32e8b84e3287b4be5a95970063542522437362dd65154719c40bb3bc8449b5e4ec82a30c9bfec3f337
data/CHANGELOG.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 0.16.0
4
4
 
5
- - Use a Hash instead of named arguments for middleware options for better compatibility
5
+ - Support status code wildcards like "2XX", "4XX"
6
6
 
7
7
  ## 0.15.0
8
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openapi_first (0.16.0.beta1)
4
+ openapi_first (0.16.0)
5
5
  deep_merge (>= 1.2.1)
6
6
  hanami-router (~> 2.0.alpha5)
7
7
  hanami-utils (~> 2.0.alpha3)
@@ -15,7 +15,7 @@ GEM
15
15
  specs:
16
16
  ast (2.4.2)
17
17
  coderay (1.1.3)
18
- concurrent-ruby (1.1.9)
18
+ concurrent-ruby (1.1.10)
19
19
  deep_merge (1.2.2)
20
20
  diff-lcs (1.5.0)
21
21
  dry-transformer (0.1.1)
@@ -32,7 +32,7 @@ GEM
32
32
  hansi (0.2.0)
33
33
  json_refs (0.1.7)
34
34
  hana
35
- json_schemer (0.2.18)
35
+ json_schemer (0.2.19)
36
36
  ecma-re-validator (~> 0.3)
37
37
  hana (~> 1.3)
38
38
  regexp_parser (~> 2.0)
@@ -87,6 +87,7 @@ GEM
87
87
  uri_template (0.7.0)
88
88
 
89
89
  PLATFORMS
90
+ arm64-darwin-21
90
91
  x86_64-darwin-20
91
92
 
92
93
  DEPENDENCIES
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- openapi_first (0.16.0.beta1)
4
+ openapi_first (0.15.0)
5
5
  deep_merge (>= 1.2.1)
6
6
  hanami-router (~> 2.0.alpha5)
7
7
  hanami-utils (~> 2.0.alpha3)
@@ -93,6 +93,7 @@ module OpenapiFirst
93
93
 
94
94
  def response_by_code(status)
95
95
  operation_object.dig('responses', status.to_s) ||
96
+ operation_object.dig('responses', "#{status / 100}XX") ||
96
97
  operation_object.dig('responses', 'default')
97
98
  end
98
99
 
@@ -10,9 +10,9 @@ module OpenapiFirst
10
10
  class RequestValidation # rubocop:disable Metrics/ClassLength
11
11
  prepend RouterRequired
12
12
 
13
- def initialize(app, options = {})
13
+ def initialize(app, raise_error: false)
14
14
  @app = app
15
- @raise = options.fetch(:raise_error, false)
15
+ @raise = raise_error
16
16
  end
17
17
 
18
18
  def call(env) # rubocop:disable Metrics/AbcSize
@@ -7,13 +7,15 @@ module OpenapiFirst
7
7
  class Router
8
8
  def initialize(
9
9
  app,
10
- options
10
+ spec:,
11
+ raise_error: false,
12
+ not_found: :halt,
13
+ parent_app: nil
11
14
  )
12
15
  @app = app
13
- @parent_app = options.fetch(:parent_app, nil)
14
- @raise = options.fetch(:raise_error, false)
15
- @not_found = options.fetch(:not_found, :halt)
16
- spec = options.fetch(:spec)
16
+ @parent_app = parent_app
17
+ @raise = raise_error
18
+ @not_found = not_found
17
19
  @filepath = spec.filepath
18
20
  @router = build_router(spec.operations)
19
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenapiFirst
4
- VERSION = '0.16.0.beta1'
4
+ VERSION = '0.16.0'
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.16.0.beta1
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Haller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-15 00:00:00.000000000 Z
11
+ date: 2022-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge
@@ -239,11 +239,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
239
239
  version: 2.6.0
240
240
  required_rubygems_version: !ruby/object:Gem::Requirement
241
241
  requirements:
242
- - - ">"
242
+ - - ">="
243
243
  - !ruby/object:Gem::Version
244
- version: 1.3.1
244
+ version: '0'
245
245
  requirements: []
246
- rubygems_version: 3.3.3
246
+ rubygems_version: 3.3.7
247
247
  signing_key:
248
248
  specification_version: 4
249
249
  summary: Implement REST APIs based on OpenApi.