openapi_first 0.16.0.beta1 → 0.17.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: a6e1915ef20b0c31bd58a5f0bbba3d91b9be2915c9c0e1598e085d4bea142a06
4
+ data.tar.gz: 42c62a18aab203b1920adf1367cd9bc500c6e31b1e82fb8b4370ca34cedb372d
5
5
  SHA512:
6
- metadata.gz: 0e08b5d1b12f3379ef2f28ab98da925a43c7adc69ea617c305dedb06fbe63e7843cf0d861cd32d7942f7770b4f7ac9bb2762ffb179374fd15deff2b86f64899f
7
- data.tar.gz: ac406a2a868a44b8cfb8d54a71b5c4fb1d1078f666c6f3ee683a191c83c090a8312f59bd399e089edb4062d309ca98df02ee8b2078a445c1e3b16e5e19cfd462
6
+ metadata.gz: a7985ff17cce925cb8ed24b47efaea39f4a2bef3a7f029de3edbef38a6ae555e57784d1346cfa0acbfd18b3d70124c4019dd0a5533990dccfcc408667b70b693
7
+ data.tar.gz: 8e28e55faf6de5246ff87c0943f507c2f93afe4d96f5bbde423feb15607295e7888d25c4add8054ec90103a4305161366f72c8088d0d8f64e053f9ba6902b592
data/CHANGELOG.md CHANGED
@@ -1,8 +1,17 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 0.17.0
4
4
 
5
- - Use a Hash instead of named arguments for middleware options for better compatibility
5
+ - BREAKING CHANGE: Use a Hash instead of named arguments for middleware options for better compatibility
6
+ Using named arguments is actually not supported in Rack.
7
+
8
+ ## 0.16.1
9
+
10
+ - Pin hanami-router version, because alpha6 is broken.
11
+
12
+ ## 0.16.0
13
+
14
+ - Support status code wildcards like "2XX", "4XX"
6
15
 
7
16
  ## 0.15.0
8
17
 
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openapi_first (0.16.0.beta1)
4
+ openapi_first (0.17.0)
5
5
  deep_merge (>= 1.2.1)
6
- hanami-router (~> 2.0.alpha5)
7
- hanami-utils (~> 2.0.alpha3)
8
- json_refs (>= 0.1.7)
6
+ hanami-router (= 2.0.alpha5)
7
+ hanami-utils (= 2.0.alpha3)
8
+ json_refs (~> 0.1, >= 0.1.7)
9
9
  json_schemer (~> 0.2.16)
10
10
  multi_json (~> 1.14)
11
11
  rack (~> 2.2)
@@ -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.20)
36
36
  ecma-re-validator (~> 0.3)
37
37
  hana (~> 1.3)
38
38
  regexp_parser (~> 2.0)
@@ -44,8 +44,8 @@ GEM
44
44
  mustermann-contrib (1.1.1)
45
45
  hansi (~> 0.2.0)
46
46
  mustermann (= 1.1.1)
47
- parallel (1.21.0)
48
- parser (3.1.0.0)
47
+ parallel (1.22.1)
48
+ parser (3.1.1.0)
49
49
  ast (~> 2.4.1)
50
50
  pry (0.14.1)
51
51
  coderay (~> 1.1)
@@ -66,27 +66,28 @@ GEM
66
66
  rspec-expectations (3.11.0)
67
67
  diff-lcs (>= 1.2.0, < 2.0)
68
68
  rspec-support (~> 3.11.0)
69
- rspec-mocks (3.11.0)
69
+ rspec-mocks (3.11.1)
70
70
  diff-lcs (>= 1.2.0, < 2.0)
71
71
  rspec-support (~> 3.11.0)
72
72
  rspec-support (3.11.0)
73
- rubocop (1.25.1)
73
+ rubocop (1.27.0)
74
74
  parallel (~> 1.10)
75
75
  parser (>= 3.1.0.0)
76
76
  rainbow (>= 2.2.2, < 4.0)
77
77
  regexp_parser (>= 1.8, < 3.0)
78
78
  rexml
79
- rubocop-ast (>= 1.15.1, < 2.0)
79
+ rubocop-ast (>= 1.16.0, < 2.0)
80
80
  ruby-progressbar (~> 1.7)
81
81
  unicode-display_width (>= 1.4.0, < 3.0)
82
- rubocop-ast (1.15.2)
83
- parser (>= 3.0.1.1)
82
+ rubocop-ast (1.16.0)
83
+ parser (>= 3.1.1.0)
84
84
  ruby-progressbar (1.11.0)
85
85
  ruby2_keywords (0.0.5)
86
86
  unicode-display_width (2.1.0)
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
data/benchmarks/Gemfile CHANGED
@@ -7,8 +7,9 @@ gem 'benchmark-memory'
7
7
  gem 'committee'
8
8
  gem 'grape'
9
9
  gem 'hanami-api'
10
- gem 'hanami-router', '~> 2.0.0.alpha5'
10
+ gem 'hanami-router'
11
11
  gem 'multi_json'
12
12
  gem 'openapi_first', path: '../'
13
+ gem 'roda'
13
14
  gem 'sinatra'
14
15
  gem 'syro'
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- openapi_first (0.16.0.beta1)
4
+ openapi_first (0.17.0)
5
5
  deep_merge (>= 1.2.1)
6
- hanami-router (~> 2.0.alpha5)
7
- hanami-utils (~> 2.0.alpha3)
8
- json_refs (>= 0.1.7)
6
+ hanami-router (= 2.0.alpha5)
7
+ hanami-utils (= 2.0.alpha3)
8
+ json_refs (~> 0.1, >= 0.1.7)
9
9
  json_schemer (~> 0.2.16)
10
10
  multi_json (~> 1.14)
11
11
  rack (~> 2.2)
@@ -13,12 +13,12 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activesupport (7.0.2.2)
16
+ activesupport (7.0.2.3)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 1.6, < 2)
19
19
  minitest (>= 5.1)
20
20
  tzinfo (~> 2.0)
21
- benchmark-ips (2.9.3)
21
+ benchmark-ips (2.10.0)
22
22
  benchmark-memory (0.2.0)
23
23
  memory_profiler (~> 1)
24
24
  builder (3.2.4)
@@ -26,7 +26,7 @@ GEM
26
26
  json_schema (~> 0.14, >= 0.14.3)
27
27
  openapi_parser (>= 0.11.1, < 1.0)
28
28
  rack (>= 1.5)
29
- concurrent-ruby (1.1.9)
29
+ concurrent-ruby (1.1.10)
30
30
  deep_merge (1.2.2)
31
31
  dry-configurable (0.14.0)
32
32
  concurrent-ruby (~> 1.0)
@@ -63,16 +63,16 @@ GEM
63
63
  mustermann (~> 1.0)
64
64
  mustermann-contrib (~> 1.0)
65
65
  rack (~> 2.0)
66
- hanami-utils (2.0.0.alpha6)
66
+ hanami-utils (2.0.0.alpha3)
67
67
  concurrent-ruby (~> 1.0)
68
68
  dry-transformer (~> 0.1)
69
69
  hansi (0.2.0)
70
- i18n (1.9.1)
70
+ i18n (1.10.0)
71
71
  concurrent-ruby (~> 1.0)
72
72
  json_refs (0.1.7)
73
73
  hana
74
74
  json_schema (0.21.0)
75
- json_schemer (0.2.18)
75
+ json_schemer (0.2.20)
76
76
  ecma-re-validator (~> 0.3)
77
77
  hana (~> 1.3)
78
78
  regexp_parser (~> 2.0)
@@ -91,15 +91,17 @@ GEM
91
91
  rack (2.2.3)
92
92
  rack-accept (0.4.5)
93
93
  rack (>= 0.4)
94
- rack-protection (2.1.0)
94
+ rack-protection (2.2.0)
95
95
  rack
96
96
  regexp_parser (2.2.1)
97
+ roda (3.54.0)
98
+ rack
97
99
  ruby2_keywords (0.0.5)
98
100
  seg (1.2.0)
99
- sinatra (2.1.0)
101
+ sinatra (2.2.0)
100
102
  mustermann (~> 1.0)
101
103
  rack (~> 2.2)
102
- rack-protection (= 2.1.0)
104
+ rack-protection (= 2.2.0)
103
105
  tilt (~> 2.0)
104
106
  syro (3.2.1)
105
107
  rack (>= 1.6.0)
@@ -110,7 +112,7 @@ GEM
110
112
  uri_template (0.7.0)
111
113
 
112
114
  PLATFORMS
113
- x86_64-darwin-20
115
+ arm64-darwin-21
114
116
 
115
117
  DEPENDENCIES
116
118
  benchmark-ips
@@ -118,11 +120,12 @@ DEPENDENCIES
118
120
  committee
119
121
  grape
120
122
  hanami-api
121
- hanami-router (~> 2.0.0.alpha5)
123
+ hanami-router
122
124
  multi_json
123
125
  openapi_first!
126
+ roda
124
127
  sinatra
125
128
  syro
126
129
 
127
130
  BUNDLED WITH
128
- 2.2.28
131
+ 2.3.10
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'roda'
4
+ require 'multi_json'
5
+
6
+ class App < Roda
7
+ route do |r|
8
+ r.on 'hello' do
9
+ r.on :id do
10
+ r.get do
11
+ MultiJson.dump({ hello: 'world', id: r.params[:id] })
12
+ end
13
+ end
14
+
15
+ r.get do
16
+ MultiJson.dump([{ hello: 'world' }])
17
+ end
18
+
19
+ r.post do
20
+ response.status = 201
21
+ MultiJson.dump({ hello: 'world' })
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ run App.freeze.app
@@ -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
 
@@ -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.17.0'
5
5
  end
@@ -35,9 +35,9 @@ Gem::Specification.new do |spec|
35
35
  spec.required_ruby_version = '>= 2.6.0'
36
36
 
37
37
  spec.add_runtime_dependency 'deep_merge', '>= 1.2.1'
38
- spec.add_runtime_dependency 'hanami-router', '~> 2.0.alpha5'
39
- spec.add_runtime_dependency 'hanami-utils', '~> 2.0.alpha3'
40
- spec.add_runtime_dependency 'json_refs', '>= 0.1.7'
38
+ spec.add_runtime_dependency 'hanami-router', '2.0.alpha5'
39
+ spec.add_runtime_dependency 'hanami-utils', '2.0.alpha3'
40
+ spec.add_runtime_dependency 'json_refs', '~> 0.1', '>= 0.1.7'
41
41
  spec.add_runtime_dependency 'json_schemer', '~> 0.2.16'
42
42
  spec.add_runtime_dependency 'multi_json', '~> 1.14'
43
43
  spec.add_runtime_dependency 'rack', '~> 2.2'
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.17.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-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge
@@ -28,34 +28,37 @@ dependencies:
28
28
  name: hanami-router
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.0.alpha5
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.0.alpha5
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: hanami-utils
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
47
  version: 2.0.alpha3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - '='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.0.alpha3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: json_refs
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.1'
59
62
  - - ">="
60
63
  - !ruby/object:Gem::Version
61
64
  version: 0.1.7
@@ -63,6 +66,9 @@ dependencies:
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
65
68
  requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '0.1'
66
72
  - - ">="
67
73
  - !ruby/object:Gem::Version
68
74
  version: 0.1.7
@@ -194,6 +200,7 @@ files:
194
200
  - benchmarks/apps/openapi_first.ru
195
201
  - benchmarks/apps/openapi_first_with_hanami_api.ru
196
202
  - benchmarks/apps/openapi_first_with_response_validation.ru
203
+ - benchmarks/apps/roda.ru
197
204
  - benchmarks/apps/sinatra.ru
198
205
  - benchmarks/apps/syro.ru
199
206
  - benchmarks/benchmarks.rb
@@ -239,11 +246,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
239
246
  version: 2.6.0
240
247
  required_rubygems_version: !ruby/object:Gem::Requirement
241
248
  requirements:
242
- - - ">"
249
+ - - ">="
243
250
  - !ruby/object:Gem::Version
244
- version: 1.3.1
251
+ version: '0'
245
252
  requirements: []
246
- rubygems_version: 3.3.3
253
+ rubygems_version: 3.3.7
247
254
  signing_key:
248
255
  specification_version: 4
249
256
  summary: Implement REST APIs based on OpenApi.