openapi_first 0.19.0 → 0.21.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: d09bae8b5126245d86fceeb81b2d0d46fb1a9e1cb10370527327edb3e370fe59
4
- data.tar.gz: 2bd5e71bd8022506be07ab7c60b2740d490fc0f2a0995ded0f6a9c6dc4d165e3
3
+ metadata.gz: 0b8b03aaa251de1bdb5cbba71de089bf1ffc6b9dbb96512008f88e783c3cea27
4
+ data.tar.gz: 02eb6cec864e9b5ed272d4392b31fd9e006713d3a8b00df9b26e9a52fa68e555
5
5
  SHA512:
6
- metadata.gz: 4d7d449f19fe40c49ea701eb28aca2a140ec41a5efb5be7433a5a60d85376a139a18c772ff34f211fbfb02e557ddddfdfad8ca547a695cb849bd62b69015775d
7
- data.tar.gz: 6693234aab12e85893fedfa831ff21c831f00aa4040475a8a6e9fdbc5a2500e094f552ff1efef1c459af4df2eff21ad9f7ac4b6f93b2628f76d5f5169c4ad228
6
+ metadata.gz: e37e99e982f0ead9d54587683fa74491e69998f520b1cfb4993c9e1ee81273537dfdf1751c77daef856ab3c3051660589d2f8ac6e58508fd11d3ea130734d2a5
7
+ data.tar.gz: 6944ae2444da29928eeb12e70326505aa154f1c36a09f033083098b1e34be766b075257fd2459b94574370fa8cc417ef488f74dafcec6026eaab07a47f471445
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.6
2
+ TargetRubyVersion: 3.0.5
3
3
  NewCops: enable
4
4
  SuggestExtensions: false
5
5
  Style/Documentation:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 0.21.0
6
+
7
+ - Fix: Query parameter validation does not fail if header parameters are defined (Thanks to [JF Lalonde](https://github.com/JF-Lalonde))
8
+ - Update Ruby dependency to >= 3.0.5
9
+ - Handle simple form-data in request bodies (see https://github.com/ahx/openapi_first/issues/149)
10
+ - Update to hanami-router 2.0.0 stable
11
+
12
+ ## 0.20.0
13
+
14
+ - You can pass a filepath to `spec:` now so you no longer have to call `OpenapiFirst.load` anymore.
15
+ - Router is optional now.
16
+ You no longer have to add `Router` to your middleware stack. You still can add it to customize behaviour by setting options, but you no longer have to add it.
17
+ If you don't add the Router, make sure you pass `spec:` to your request/response validation middleware.
18
+ - Support "4xx" and "4XX" response definitions.
19
+ (4XX is defined in the standard, but 2xx is used in the wild as well 🦁.)
20
+ - Removed warning about missing operationId, because operationId is not used until the Responder is used.
21
+ - Raise HandlerNotFoundError when handler cannot be found
22
+
3
23
  ## 0.19.0
4
24
 
5
25
  - Add `RackResponder`
@@ -37,7 +57,7 @@ Yanked. No useful changes.
37
57
 
38
58
  ## 0.14.1
39
59
 
40
- - Bugfix: Don't mix path- and operation-level parameters for request validation
60
+ - Fix: Don't mix path- and operation-level parameters for request validation
41
61
 
42
62
  ## 0.14.0
43
63
 
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openapi_first (0.19.0)
4
+ openapi_first (0.21.0)
5
5
  deep_merge (>= 1.2.1)
6
- hanami-router (= 2.0.alpha5)
7
- hanami-utils (= 2.0.alpha3)
6
+ hanami-router (~> 2.0.0)
7
+ hanami-utils (~> 2.0.0)
8
8
  json_refs (~> 0.1, >= 0.1.7)
9
9
  json_schemer (~> 0.2.16)
10
10
  multi_json (~> 1.14)
@@ -15,78 +15,84 @@ GEM
15
15
  specs:
16
16
  ast (2.4.2)
17
17
  coderay (1.1.3)
18
- concurrent-ruby (1.1.10)
18
+ concurrent-ruby (1.2.2)
19
19
  deep_merge (1.2.2)
20
20
  diff-lcs (1.5.0)
21
- dry-transformer (0.1.1)
21
+ dry-core (1.0.0)
22
+ concurrent-ruby (~> 1.0)
23
+ zeitwerk (~> 2.6)
24
+ dry-transformer (1.0.1)
25
+ zeitwerk (~> 2.6)
22
26
  ecma-re-validator (0.4.0)
23
27
  regexp_parser (~> 2.2)
24
28
  hana (1.3.7)
25
- hanami-router (2.0.0.alpha5)
26
- mustermann (~> 1.0)
27
- mustermann-contrib (~> 1.0)
29
+ hanami-router (2.0.2)
30
+ mustermann (~> 3.0)
31
+ mustermann-contrib (~> 3.0)
28
32
  rack (~> 2.0)
29
- hanami-utils (2.0.0.alpha3)
33
+ hanami-utils (2.0.3)
30
34
  concurrent-ruby (~> 1.0)
31
- dry-transformer (~> 0.1)
35
+ dry-core (~> 1.0, < 2)
36
+ dry-transformer (~> 1.0, < 2)
32
37
  hansi (0.2.1)
33
- json (2.6.2)
38
+ json (2.6.3)
34
39
  json_refs (0.1.7)
35
40
  hana
36
- json_schemer (0.2.21)
41
+ json_schemer (0.2.24)
37
42
  ecma-re-validator (~> 0.3)
38
43
  hana (~> 1.3)
39
44
  regexp_parser (~> 2.0)
40
45
  uri_template (~> 0.7)
41
46
  method_source (1.0.0)
42
47
  multi_json (1.15.0)
43
- mustermann (1.1.2)
48
+ mustermann (3.0.0)
44
49
  ruby2_keywords (~> 0.0.1)
45
- mustermann-contrib (1.1.2)
50
+ mustermann-contrib (3.0.0)
46
51
  hansi (~> 0.2.0)
47
- mustermann (= 1.1.2)
52
+ mustermann (= 3.0.0)
48
53
  parallel (1.22.1)
49
- parser (3.1.2.0)
54
+ parser (3.2.1.0)
50
55
  ast (~> 2.4.1)
51
- pry (0.14.1)
56
+ pry (0.14.2)
52
57
  coderay (~> 1.1)
53
58
  method_source (~> 1.0)
54
- rack (2.2.4)
59
+ rack (2.2.6.2)
55
60
  rack-test (1.1.0)
56
61
  rack (>= 1.0, < 3)
57
62
  rainbow (3.1.1)
58
63
  rake (13.0.6)
59
- regexp_parser (2.5.0)
64
+ regexp_parser (2.7.0)
60
65
  rexml (3.2.5)
61
- rspec (3.11.0)
62
- rspec-core (~> 3.11.0)
63
- rspec-expectations (~> 3.11.0)
64
- rspec-mocks (~> 3.11.0)
65
- rspec-core (3.11.0)
66
- rspec-support (~> 3.11.0)
67
- rspec-expectations (3.11.0)
66
+ rspec (3.12.0)
67
+ rspec-core (~> 3.12.0)
68
+ rspec-expectations (~> 3.12.0)
69
+ rspec-mocks (~> 3.12.0)
70
+ rspec-core (3.12.1)
71
+ rspec-support (~> 3.12.0)
72
+ rspec-expectations (3.12.2)
68
73
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.11.0)
70
- rspec-mocks (3.11.1)
74
+ rspec-support (~> 3.12.0)
75
+ rspec-mocks (3.12.3)
71
76
  diff-lcs (>= 1.2.0, < 2.0)
72
- rspec-support (~> 3.11.0)
73
- rspec-support (3.11.0)
74
- rubocop (1.32.0)
77
+ rspec-support (~> 3.12.0)
78
+ rspec-support (3.12.0)
79
+ rubocop (1.45.1)
75
80
  json (~> 2.3)
76
81
  parallel (~> 1.10)
77
- parser (>= 3.1.0.0)
82
+ parser (>= 3.2.0.0)
78
83
  rainbow (>= 2.2.2, < 4.0)
79
84
  regexp_parser (>= 1.8, < 3.0)
80
85
  rexml (>= 3.2.5, < 4.0)
81
- rubocop-ast (>= 1.19.1, < 2.0)
86
+ rubocop-ast (>= 1.24.1, < 2.0)
82
87
  ruby-progressbar (~> 1.7)
83
- unicode-display_width (>= 1.4.0, < 3.0)
84
- rubocop-ast (1.19.1)
85
- parser (>= 3.1.1.0)
88
+ unicode-display_width (>= 2.4.0, < 3.0)
89
+ rubocop-ast (1.26.0)
90
+ parser (>= 3.2.1.0)
86
91
  ruby-progressbar (1.11.0)
87
92
  ruby2_keywords (0.0.5)
88
- unicode-display_width (2.2.0)
93
+ unicode-display_width (2.4.2)
89
94
  uri_template (0.7.0)
95
+ zeitwerk (2.6.7)
90
96
 
91
97
  PLATFORMS
92
98
  arm64-darwin-21
data/README.md CHANGED
@@ -18,42 +18,28 @@ Here's a [comparison between committee and openapi_first](https://gist.github.co
18
18
 
19
19
  OpenapiFirst consists of these Rack middlewares:
20
20
 
21
- - [`OpenapiFirst::Router`](#OpenapiFirst::Router) – Finds the OpenAPI operation for the current request or returns 404 if no operation was found. This can be customized.
22
21
  - [`OpenapiFirst::RequestValidation`](#OpenapiFirst::RequestValidation) – Validates the request against the API description and returns 400 if the request is invalid.
23
- - [`OpenapiFirst::Responder`](#OpenapiFirst::Responder) calls the [handler](#handlers) found for the operation, sets the correct content-type and serializes the response body to json if needed.
24
- - [`OpenapiFirst::RackResponder`](#OpenapiFirst::RackResponder) calls the [handler](#handlers) found for the operation as a normal Rack application (`call(env)`) and returns the result as is.
25
22
  - [`OpenapiFirst::ResponseValidation`](#OpenapiFirst::ResponseValidation) Validates the response and raises an exception if the response body is invalid.
23
+ - [`OpenapiFirst::Router`](#OpenapiFirst::Router) – This internal middleware is added automatically before request/response validation. Finds the OpenAPI operation for the current request or returns 404 if no operation was found. This can be customized by adding it yourself.
26
24
 
27
- ## OpenapiFirst::Router
28
-
29
- You always have to add this middleware first in order to make the other middlewares work.
30
-
31
- ```ruby
32
- use OpenapiFirst::Router, spec: OpenapiFirst.load('./openapi/openapi.yaml')
33
- ```
34
-
35
- This middleware adds `env[OpenapiFirst::OPERATION]` which holds an Operation object that responds to `#operation_id`, `#path` (and `#[]` to access raw fields).
36
-
37
- ### Options and defaults
38
25
 
39
- | Name | Possible values | Description | Default |
40
- | :------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
41
- | `spec:` | | The spec loaded via `OpenapiFirst.load` | |
42
- | `raise_error:` | `false`, `true` | If set to true the middleware raises `OpenapiFirst::NotFoundError` when a path or method was not found in the API description. This is useful during testing to spot an incomplete API description. | `false` (don't raise an exception) |
43
- | `not_found:` | `:continue`, `:halt` | If set to `:continue` the middleware will not return 404 (405, 415), but just pass handling the request to the next middleware or application in the Rack stack. If combined with `raise_error: true` `raise_error` gets preference and an exception is raised. | `:halt` (return 4xx response) |
26
+ And these Rack apps:
27
+ - [`OpenapiFirst::Responder`](#OpenapiFirst::Responder) calls the [handler](#handlers) found for the operation, sets the correct content-type and serializes the response body to json if needed.
28
+ - [`OpenapiFirst::RackResponder`](#OpenapiFirst::RackResponder) calls the [handler](#handlers) found for the operation as a normal Rack application (`call(env)`) and returns the result as is.
44
29
 
45
30
  ## OpenapiFirst::RequestValidation
46
31
 
47
32
  This middleware returns a 400 status code with a body that describes the error if the request is not valid.
48
33
 
49
34
  ```ruby
50
- use OpenapiFirst::RequestValidation
35
+ use OpenapiFirst::RequestValidation, spec: 'openapi.yaml'
51
36
  ```
52
37
 
53
38
  ### Options and defaults
54
39
 
55
40
  | Name | Possible values | Description | Default |
56
41
  | :------------- | --------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------- |
42
+ | `spec:` | | The path to the spec file or spec loaded via `OpenapiFirst.load`
57
43
  | `raise_error:` | `false`, `true` | If set to true the middleware raises `OpenapiFirst::RequestInvalidError` instead of returning 4xx. | `false` (don't raise an exception) |
58
44
 
59
45
  The error responses conform with [JSON:API](https://jsonapi.org).
@@ -107,21 +93,38 @@ Request validation fails if request includes a property with `readOnly: true`.
107
93
 
108
94
  Response validation fails if response body includes a property with `writeOnly: true`.
109
95
 
110
- ## OpenapiFirst::Responder
96
+ ## OpenapiFirst::ResponseValidation
97
+
98
+ This middleware is especially useful when testing. It _always_ raises an error if the response is not valid.
111
99
 
112
- This Rack endpoint maps the HTTP request to a method call based on the [operationId](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operation-object) in your API description and calls it. Responder also adds a content-type to the response.
113
100
 
114
101
  ```ruby
115
- run OpenapiFirst::Responder
102
+ use OpenapiFirst::ResponseValidation, spec: 'openapi.yaml' if ENV['RACK_ENV'] == 'test'
116
103
  ```
117
104
 
118
105
  ### Options
119
106
 
120
- | Name | Description |
121
- | :----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
122
- | `namespace:` | Optional. A class or module where to find the handler method. |
123
- | `resolver:` | Optional. An object that responds to `#call(operation)` and returns a [handler](#handlers). By default this is an instance of [DefaultOperationResolver](#OpenapiFirst::DefaultOperationResolver) |
107
+ | Name | Possible values | Description | Default |
108
+ | :------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
109
+ | `spec:` | | The path to the spec file or spec loaded via `OpenapiFirst.load`
110
+
111
+ ## OpenapiFirst::Router
112
+
113
+ This middleware is used automatically, but you can add it to the top of your middleware stack if you want to change configuration.
124
114
 
115
+ ```ruby
116
+ use OpenapiFirst::Router, spec: './openapi/openapi.yaml'
117
+ ```
118
+
119
+ This middleware adds `env[OpenapiFirst::OPERATION]` which holds an Operation object that responds to `#operation_id`, `#path` (and `#[]` to access raw fields).
120
+
121
+ ### Options and defaults
122
+
123
+ | Name | Possible values | Description | Default |
124
+ | :------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
125
+ | `spec:` | | The path to the spec file or spec loaded via `OpenapiFirst.load` | |
126
+ | `raise_error:` | `false`, `true` | If set to true the middleware raises `OpenapiFirst::NotFoundError` when a path or method was not found in the API description. This is useful during testing to spot an incomplete API description. | `false` (don't raise an exception) |
127
+ | `not_found:` | `:continue`, `:halt` | If set to `:continue` the middleware will not return 404 (405, 415), but just pass handling the request to the next middleware or application in the Rack stack. If combined with `raise_error: true` `raise_error` gets preference and an exception is raised. | `:halt` (return 4xx response) |
125
128
 
126
129
  ## OpenapiFirst::RackResponder
127
130
 
@@ -139,6 +142,20 @@ run OpenapiFirst::RackResponder
139
142
  | `namespace:` | Optional. A class or module where to find the handler method. |
140
143
  | `resolver:` | Optional. An object that responds to `#call(operation)` and returns a [handler](#handlers). By default this is an instance of [DefaultOperationResolver](#OpenapiFirst::DefaultOperationResolver) |
141
144
 
145
+ ## OpenapiFirst::Responder
146
+
147
+ This Rack endpoint maps the HTTP request to a method call based on the [operationId](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operation-object) in your API description and calls it. Responder also adds a content-type to the response.
148
+
149
+ ```ruby
150
+ run OpenapiFirst::Responder
151
+ ```
152
+
153
+ ### Options
154
+
155
+ | Name | Description |
156
+ | :----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
157
+ | `namespace:` | Optional. A class or module where to find the handler method. |
158
+ | `resolver:` | Optional. An object that responds to `#call(operation)` and returns a [handler](#handlers). By default this is an instance of [DefaultOperationResolver](#OpenapiFirst::DefaultOperationResolver) |
142
159
 
143
160
  ### OpenapiFirst::DefaultOperationResolver
144
161
 
@@ -164,14 +181,6 @@ There are two ways to set the response body:
164
181
  - Calling `res.write "things"` (see [Rack::Response](https://www.rubydoc.info/github/rack/rack/Rack/Response))
165
182
  - Returning a value which will get converted to JSON
166
183
 
167
- ## OpenapiFirst::ResponseValidation
168
-
169
- This middleware is especially useful when testing. It _always_ raises an error if the response is not valid.
170
-
171
- ```ruby
172
- use OpenapiFirst::ResponseValidation if ENV['RACK_ENV'] == 'test'
173
- ```
174
-
175
184
  ## Standalone usage
176
185
 
177
186
  Instead of composing these middlewares yourself you can use `OpenapiFirst.app`.
@@ -248,8 +257,7 @@ Instead of using the ResponseValidation middleware you can validate the response
248
257
  ```ruby
249
258
  # In your test (rspec example):
250
259
  require 'openapi_first'
251
- spec = OpenapiFirst.load('petstore.yaml')
252
- validator = OpenapiFirst::ResponseValidator.new(spec)
260
+ validator = OpenapiFirst::ResponseValidator.new('petstore.yaml')
253
261
 
254
262
  # This will raise an exception if it found an error
255
263
  validator.validate(last_request, last_response)
@@ -260,7 +268,7 @@ validator.validate(last_request, last_response)
260
268
  You can filter the URIs that should be handled by passing `only` to `OpenapiFirst.load`:
261
269
 
262
270
  ```ruby
263
- spec = OpenapiFirst.load './openapi/openapi.yaml', only: '/pets'.method(:==)
271
+ spec = OpenapiFirst.load('./openapi/openapi.yaml', only: { |path| path.starts_with? '/pets' })
264
272
  run OpenapiFirst.app(spec, namespace: Pets)
265
273
  ```
266
274
 
@@ -278,8 +286,7 @@ describe MyApp do
278
286
  include Rack::Test::Methods
279
287
 
280
288
  before(:all) do
281
- spec = OpenapiFirst.load('petstore.yaml')
282
- @app_wrapper = OpenapiFirst::Coverage.new(MyApp, spec)
289
+ @app_wrapper = OpenapiFirst::Coverage.new(MyApp, 'petstore.yaml')
283
290
  end
284
291
 
285
292
  after(:all) do
data/benchmarks/Gemfile CHANGED
@@ -10,6 +10,7 @@ gem 'hanami-api'
10
10
  gem 'hanami-router'
11
11
  gem 'multi_json'
12
12
  gem 'openapi_first', path: '../'
13
+ gem 'puma'
13
14
  gem 'roda'
14
15
  gem 'sinatra'
15
16
  gem 'syro'
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- openapi_first (0.19.0)
4
+ openapi_first (0.21.0)
5
5
  deep_merge (>= 1.2.1)
6
- hanami-router (= 2.0.alpha5)
7
- hanami-utils (= 2.0.alpha3)
6
+ hanami-router (~> 2.0.0)
7
+ hanami-utils (~> 2.0.0)
8
8
  json_refs (~> 0.1, >= 0.1.7)
9
9
  json_schemer (~> 0.2.16)
10
10
  multi_json (~> 1.14)
@@ -13,43 +13,40 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activesupport (7.0.2.3)
16
+ activesupport (7.0.4.2)
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.10.0)
21
+ benchmark-ips (2.11.0)
22
22
  benchmark-memory (0.2.0)
23
23
  memory_profiler (~> 1)
24
24
  builder (3.2.4)
25
- committee (4.4.0)
25
+ committee (5.0.0)
26
26
  json_schema (~> 0.14, >= 0.14.3)
27
- openapi_parser (>= 0.11.1, < 1.0)
27
+ openapi_parser (~> 1.0)
28
28
  rack (>= 1.5)
29
- concurrent-ruby (1.1.10)
29
+ concurrent-ruby (1.2.0)
30
30
  deep_merge (1.2.2)
31
- dry-configurable (0.14.0)
31
+ dry-core (1.0.0)
32
32
  concurrent-ruby (~> 1.0)
33
- dry-core (~> 0.6)
34
- dry-container (0.9.0)
33
+ zeitwerk (~> 2.6)
34
+ dry-inflector (1.0.0)
35
+ dry-logic (1.5.0)
35
36
  concurrent-ruby (~> 1.0)
36
- dry-configurable (~> 0.13, >= 0.13.0)
37
- dry-core (0.7.1)
37
+ dry-core (~> 1.0, < 2)
38
+ zeitwerk (~> 2.6)
39
+ dry-transformer (1.0.1)
40
+ zeitwerk (~> 2.6)
41
+ dry-types (1.7.0)
38
42
  concurrent-ruby (~> 1.0)
39
- dry-inflector (0.2.1)
40
- dry-logic (1.2.0)
41
- concurrent-ruby (~> 1.0)
42
- dry-core (~> 0.5, >= 0.5)
43
- dry-transformer (0.1.1)
44
- dry-types (1.5.1)
45
- concurrent-ruby (~> 1.0)
46
- dry-container (~> 0.3)
47
- dry-core (~> 0.5, >= 0.5)
48
- dry-inflector (~> 0.1, >= 0.1.2)
49
- dry-logic (~> 1.0, >= 1.0.2)
43
+ dry-core (~> 1.0, < 2)
44
+ dry-inflector (~> 1.0, < 2)
45
+ dry-logic (>= 1.4, < 2)
46
+ zeitwerk (~> 2.6)
50
47
  ecma-re-validator (0.4.0)
51
48
  regexp_parser (~> 2.2)
52
- grape (1.6.2)
49
+ grape (1.7.0)
53
50
  activesupport
54
51
  builder
55
52
  dry-types (>= 1.1)
@@ -57,59 +54,64 @@ GEM
57
54
  rack (>= 1.3.0)
58
55
  rack-accept
59
56
  hana (1.3.7)
60
- hanami-api (0.2.0)
61
- hanami-router (~> 2.0.alpha)
62
- hanami-router (2.0.0.alpha5)
63
- mustermann (~> 1.0)
64
- mustermann-contrib (~> 1.0)
57
+ hanami-api (0.3.0)
58
+ hanami-router (~> 2.0)
59
+ hanami-router (2.0.2)
60
+ mustermann (~> 3.0)
61
+ mustermann-contrib (~> 3.0)
65
62
  rack (~> 2.0)
66
- hanami-utils (2.0.0.alpha3)
63
+ hanami-utils (2.0.3)
67
64
  concurrent-ruby (~> 1.0)
68
- dry-transformer (~> 0.1)
69
- hansi (0.2.0)
70
- i18n (1.10.0)
65
+ dry-core (~> 1.0, < 2)
66
+ dry-transformer (~> 1.0, < 2)
67
+ hansi (0.2.1)
68
+ i18n (1.12.0)
71
69
  concurrent-ruby (~> 1.0)
72
70
  json_refs (0.1.7)
73
71
  hana
74
72
  json_schema (0.21.0)
75
- json_schemer (0.2.21)
73
+ json_schemer (0.2.24)
76
74
  ecma-re-validator (~> 0.3)
77
75
  hana (~> 1.3)
78
76
  regexp_parser (~> 2.0)
79
77
  uri_template (~> 0.7)
80
- memory_profiler (1.0.0)
81
- minitest (5.15.0)
78
+ memory_profiler (1.0.1)
79
+ minitest (5.17.0)
82
80
  multi_json (1.15.0)
83
- mustermann (1.1.1)
81
+ mustermann (3.0.0)
84
82
  ruby2_keywords (~> 0.0.1)
85
- mustermann-contrib (1.1.1)
83
+ mustermann-contrib (3.0.0)
86
84
  hansi (~> 0.2.0)
87
- mustermann (= 1.1.1)
88
- mustermann-grape (1.0.1)
85
+ mustermann (= 3.0.0)
86
+ mustermann-grape (1.0.2)
89
87
  mustermann (>= 1.0.0)
90
- openapi_parser (0.15.0)
91
- rack (2.2.3.1)
88
+ nio4r (2.5.8)
89
+ openapi_parser (1.0.0)
90
+ puma (6.1.0)
91
+ nio4r (~> 2.0)
92
+ rack (2.2.6.2)
92
93
  rack-accept (0.4.5)
93
94
  rack (>= 0.4)
94
- rack-protection (2.2.0)
95
+ rack-protection (3.0.5)
95
96
  rack
96
- regexp_parser (2.5.0)
97
- roda (3.54.0)
97
+ regexp_parser (2.7.0)
98
+ roda (3.65.0)
98
99
  rack
99
100
  ruby2_keywords (0.0.5)
100
101
  seg (1.2.0)
101
- sinatra (2.2.0)
102
- mustermann (~> 1.0)
103
- rack (~> 2.2)
104
- rack-protection (= 2.2.0)
102
+ sinatra (3.0.5)
103
+ mustermann (~> 3.0)
104
+ rack (~> 2.2, >= 2.2.4)
105
+ rack-protection (= 3.0.5)
105
106
  tilt (~> 2.0)
106
107
  syro (3.2.1)
107
108
  rack (>= 1.6.0)
108
109
  seg
109
- tilt (2.0.10)
110
- tzinfo (2.0.4)
110
+ tilt (2.0.11)
111
+ tzinfo (2.0.6)
111
112
  concurrent-ruby (~> 1.0)
112
113
  uri_template (0.7.0)
114
+ zeitwerk (2.6.7)
113
115
 
114
116
  PLATFORMS
115
117
  arm64-darwin-21
@@ -124,6 +126,7 @@ DEPENDENCIES
124
126
  hanami-router
125
127
  multi_json
126
128
  openapi_first!
129
+ puma
127
130
  roda
128
131
  sinatra
129
132
  syro
@@ -0,0 +1,29 @@
1
+ # How to run these bechmarks
2
+
3
+ ## Setup
4
+
5
+ ```bash
6
+ cd benchmarks
7
+ bundle install
8
+ ```
9
+
10
+ ## Run Ruby benchmarks
11
+
12
+ This compares ips and memory usage for all apps defined in /apps
13
+
14
+ ```bash
15
+ bundle exec ruby benchmarks.rb
16
+ ```
17
+
18
+ ## Run benchmark using [wrk](https://github.com/wg/wrk)
19
+
20
+ 1. Start the example app
21
+ Example: openapi_first
22
+ ```bash
23
+ bundle exec puma apps/openapi_first_with_response_validation.ru
24
+ ```
25
+
26
+ 2. Run wrk
27
+ ```bash
28
+ ./benchmark-wrk.sh
29
+ ```