rspec-openapi 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +3 -0
- data/lib/rspec/openapi.rb +2 -1
- data/lib/rspec/openapi/record_builder.rb +1 -1
- data/lib/rspec/openapi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98be98f98f98819f1d1b018ad1a155184ebbe1c226b96414895acc0f60106b18
|
4
|
+
data.tar.gz: 6985138afe53b9223647f67d8802acdab580d737c18caec6b312d625d649d7c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13906efcf4d94054aea6c6132c09990bc99f264fc3fc37842f6d4d98515a5974f91a39cc3c7d749f0b2f24107e7fc9fb6bb94cfa6f3655fa0f13429101d17a20
|
7
|
+
data.tar.gz: 10ca07bb2370cf61dee4bdbc0d19d1194d64daf558813d8fff113868226a5d1ff6036f71071f58106492592e012ab999dc430976e1e5b7a4361dc36ec1bc5fb8
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
## Unreleased
|
2
|
+
|
3
|
+
* Add `RSpec::OpenAPI.description_builder` config to dynamically generate a description [experimental]
|
4
|
+
[#6](https://github.com/k0kubun/rspec-openapi/issues/6)
|
5
|
+
|
1
6
|
## v0.3.0
|
2
7
|
|
3
|
-
* Initial support of rack-test and non-Rails apps
|
8
|
+
* Initial support of rack-test and non-Rails apps [#5](https://github.com/k0kubun/rspec-openapi/issues/5)
|
4
9
|
|
5
10
|
## v0.2.2
|
6
11
|
|
data/README.md
CHANGED
@@ -114,6 +114,9 @@ RSpec::OpenAPI.comment = <<~EOS
|
|
114
114
|
When you write a spec in spec/requests, running the spec with `OPENAPI=1 rspec` will
|
115
115
|
update this file automatically. You can also manually edit this file.
|
116
116
|
EOS
|
117
|
+
|
118
|
+
# Generate a custom description, given a RSpec example
|
119
|
+
RSpec::OpenAPI.description_builder = -> (example) { example.description }
|
117
120
|
```
|
118
121
|
|
119
122
|
### How can I add information which can't be generated from RSpec?
|
data/lib/rspec/openapi.rb
CHANGED
@@ -5,8 +5,9 @@ module RSpec::OpenAPI
|
|
5
5
|
@path = 'doc/openapi.yaml'
|
6
6
|
@comment = nil
|
7
7
|
@enable_example = true
|
8
|
+
@description_builder = -> (example) { example.description }
|
8
9
|
|
9
10
|
class << self
|
10
|
-
attr_accessor :path, :comment, :enable_example
|
11
|
+
attr_accessor :path, :comment, :enable_example, :description_builder
|
11
12
|
end
|
12
13
|
end
|
@@ -32,7 +32,7 @@ class << RSpec::OpenAPI::RecordBuilder = Object.new
|
|
32
32
|
request_params: raw_request_params(request),
|
33
33
|
request_content_type: request.content_type,
|
34
34
|
summary: summary,
|
35
|
-
description: example
|
35
|
+
description: RSpec::OpenAPI.description_builder.call(example),
|
36
36
|
status: response.status,
|
37
37
|
response_body: response.parsed_body,
|
38
38
|
response_content_type: response.content_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.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|