rspec-openapi 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4bf20b571bfadeda67cae266f85c87530c32067d5b1d9934a16ea423652a17be
4
- data.tar.gz: ae4222d06d8d4aaee18ddcabc26808fe84cdfcf1ea6674527af7ffd7aa5e0d38
3
+ metadata.gz: 98be98f98f98819f1d1b018ad1a155184ebbe1c226b96414895acc0f60106b18
4
+ data.tar.gz: 6985138afe53b9223647f67d8802acdab580d737c18caec6b312d625d649d7c7
5
5
  SHA512:
6
- metadata.gz: ef3047477727572e3c8bdab0680b5fe82264aa6653c33e5ea19c7680739db5b55bde2c51d11a3cce6c422d487f445705d549eca82068f474fcb750b6d21fdc59
7
- data.tar.gz: b3e03fedec66b64f24e83fe1023abaea2fb4accdb2e1da7dab78eb4870c0cc1338e9453e6c9cd345fe01e77258cbe39f01223b0ff4e708fd568c98dc5315b8d4
6
+ metadata.gz: 13906efcf4d94054aea6c6132c09990bc99f264fc3fc37842f6d4d98515a5974f91a39cc3c7d749f0b2f24107e7fc9fb6bb94cfa6f3655fa0f13429101d17a20
7
+ data.tar.gz: 10ca07bb2370cf61dee4bdbc0d19d1194d64daf558813d8fff113868226a5d1ff6036f71071f58106492592e012ab999dc430976e1e5b7a4361dc36ec1bc5fb8
@@ -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?
@@ -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.description,
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,
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module OpenAPI
3
- VERSION = '0.3.0'
3
+ VERSION = '0.3.1'
4
4
  end
5
5
  end
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.0
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-10 00:00:00.000000000 Z
11
+ date: 2020-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack