rspec-openapi 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +16 -0
- data/lib/rspec/openapi/record_builder.rb +5 -3
- data/lib/rspec/openapi/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bf318171323fbd3fa8d664a4f34ec1fe5af39a4d39ab5ee7b020b3871a31cb4
|
4
|
+
data.tar.gz: 610173247f3b9c99c7f5d2461bad49ae1d9000d7c8f63dfc4ac884472830c005
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b8c0402fe94dbcc43353c210acb1c9c4b182331020670bb8955dc4abf17a18732852fc4b191a3d1ded1d3613ef5e0059aa79e09084eb23bd9ce7ca5beec9e25
|
7
|
+
data.tar.gz: 6c4cd49edbaea41dfc1c2b17c89ec85dac8e1063612ff29f3c63dccde9dacd7a19eb276253363f1091a19976e0e6a20d40dc32f5deae36fa291e17f054b22eaf
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -172,6 +172,22 @@ RSpec.describe '/resources', type: :request do
|
|
172
172
|
end
|
173
173
|
```
|
174
174
|
|
175
|
+
## Customizations
|
176
|
+
|
177
|
+
Some examples' attributes can be overwritten via RSpec metadata options. Example:
|
178
|
+
|
179
|
+
```rb
|
180
|
+
describe 'GET /api/v1/posts', openapi: {
|
181
|
+
summary: 'list all posts',
|
182
|
+
description: 'list all posts ordered by pub_date',
|
183
|
+
tags: %w[v1 posts],
|
184
|
+
} do
|
185
|
+
# ...
|
186
|
+
end
|
187
|
+
```
|
188
|
+
|
189
|
+
**NOTE**: `description` key will override also the one provided by `RSpec::OpenAPI.description_builder` method.
|
190
|
+
|
175
191
|
## Links
|
176
192
|
|
177
193
|
Existing RSpec plugins which have OpenAPI integration:
|
@@ -40,6 +40,8 @@ class << RSpec::OpenAPI::RecordBuilder = Object.new
|
|
40
40
|
headers_arr << [header, header_value] if header_value
|
41
41
|
end
|
42
42
|
|
43
|
+
metadata_options = example.metadata[:openapi] || {}
|
44
|
+
|
43
45
|
RSpec::OpenAPI::Record.new(
|
44
46
|
method: request.request_method,
|
45
47
|
path: path,
|
@@ -48,9 +50,9 @@ class << RSpec::OpenAPI::RecordBuilder = Object.new
|
|
48
50
|
request_params: raw_request_params(request),
|
49
51
|
request_content_type: request.media_type,
|
50
52
|
request_headers: request_headers,
|
51
|
-
summary: summary,
|
52
|
-
tags: tags,
|
53
|
-
description: RSpec::OpenAPI.description_builder.call(example),
|
53
|
+
summary: metadata_options[:summary] || summary,
|
54
|
+
tags: metadata_options[:tags] || tags,
|
55
|
+
description: metadata_options[:description] || RSpec::OpenAPI.description_builder.call(example),
|
54
56
|
status: response.status,
|
55
57
|
response_body: response_body,
|
56
58
|
response_content_type: response.media_type,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-openapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
|
-
rubygems_version: 3.
|
93
|
+
rubygems_version: 3.3.7
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: Generate OpenAPI schema from RSpec request specs
|