rspec-openapi 0.4.0 → 0.4.1

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: 71067082bcf502d2e38341d6c357ee596851cefa9ff4e95b4ac34249261782df
4
- data.tar.gz: '03279a96e39df1126d9fac2858903382654d2daa3121d415cf163b0bb1117fd1'
3
+ metadata.gz: 3032d3fed3b9bdc2b2a8512db3d1645679163539106650c1ad05069a15ab59cd
4
+ data.tar.gz: d1d3e85b467226a857b30bfe95b5643a1a37df2c0a925e509bdd893ae3017177
5
5
  SHA512:
6
- metadata.gz: 8a3344f5ee11410e189661e1ec4a6e39ab9775e2554a9a7c92818bfee71de670ec606539ccb71f60da70b727b1e8d65366507640496947e181e2bbe25251dbe2
7
- data.tar.gz: e332d6b082d4d6215535e90b750afaf2228310f989916f7b4d1b770c972ef055f329b0c84f37dba070719b4bbee7fcb47ec7d3f0c422af66b4bd712493b51e46
6
+ metadata.gz: 0c65c74db1ada24cf360545bda34830ca82d9cbd11b6e862a0563f9fc2bf244d65a96ec74e8223c182d1a2bff72b237e30c5884c2818576f9c142585d177351b
7
+ data.tar.gz: 397cfcddeaf3c1f683b9a1cd75960bf7d61e24adfcc9988bea2533c7a781acd42f43178b2ffb45deb5b3e821090f979d18af041a078f9ca3c2c7cd124cb4aff2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v0.4.1
2
+
3
+ * Add `RSpec::OpenAPI.example_types` to hook types other than `type: :request`.
4
+ [#32](https://github.com/k0kubun/rspec-openapi/pull/32)
5
+
1
6
  ## v0.4.0
2
7
 
3
8
  * Drop `RSpec::OpenAPI.output` introduced in v0.3.20
data/README.md CHANGED
@@ -135,6 +135,9 @@ EOS
135
135
 
136
136
  # Generate a custom description, given an RSpec example
137
137
  RSpec::OpenAPI.description_builder = -> (example) { example.description }
138
+
139
+ # Change the example type(s) that will generate schema
140
+ RSpec::OpenAPI.example_types = %i[request]
138
141
  ```
139
142
 
140
143
  ### How can I add information which can't be generated from RSpec?
@@ -9,7 +9,7 @@ records = []
9
9
  records_errors = []
10
10
 
11
11
  RSpec.configuration.after(:each) do |example|
12
- if example.metadata[:type] == :request && example.metadata[:openapi] != false
12
+ if RSpec::OpenAPI.example_types.include?(example.metadata[:type]) && example.metadata[:openapi] != false
13
13
  record = RSpec::OpenAPI::RecordBuilder.build(self, example: example)
14
14
  records << record if record
15
15
  end
@@ -31,7 +31,7 @@ RSpec.configuration.after(:suite) do
31
31
  if records_errors.any?
32
32
  error_message = <<~EOS
33
33
  RSpec::OpenAPI got errors building #{records_errors.size} requests
34
-
34
+
35
35
  #{records_errors.map {|e, record| "#{e.inspect}: #{record.inspect}" }.join("\n")}
36
36
  EOS
37
37
  colorizer = ::RSpec::Core::Formatters::ConsoleCodes
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module OpenAPI
3
- VERSION = '0.4.0'
3
+ VERSION = '0.4.1'
4
4
  end
5
5
  end
data/lib/rspec/openapi.rb CHANGED
@@ -9,8 +9,9 @@ module RSpec::OpenAPI
9
9
  @application_version = '1.0.0'
10
10
  @request_headers = []
11
11
  @server_urls = []
12
+ @example_types = %i[request]
12
13
 
13
14
  class << self
14
- attr_accessor :path, :comment, :enable_example, :description_builder, :application_version, :request_headers, :server_urls
15
+ attr_accessor :path, :comment, :enable_example, :description_builder, :application_version, :request_headers, :server_urls, :example_types
15
16
  end
16
17
  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.4.0
4
+ version: 0.4.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: 2021-10-11 00:00:00.000000000 Z
11
+ date: 2021-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack