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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +3 -0
- data/lib/rspec/openapi/hooks.rb +2 -2
- data/lib/rspec/openapi/version.rb +1 -1
- data/lib/rspec/openapi.rb +2 -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: 3032d3fed3b9bdc2b2a8512db3d1645679163539106650c1ad05069a15ab59cd
|
4
|
+
data.tar.gz: d1d3e85b467226a857b30bfe95b5643a1a37df2c0a925e509bdd893ae3017177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c65c74db1ada24cf360545bda34830ca82d9cbd11b6e862a0563f9fc2bf244d65a96ec74e8223c182d1a2bff72b237e30c5884c2818576f9c142585d177351b
|
7
|
+
data.tar.gz: 397cfcddeaf3c1f683b9a1cd75960bf7d61e24adfcc9988bea2533c7a781acd42f43178b2ffb45deb5b3e821090f979d18af041a078f9ca3c2c7cd124cb4aff2
|
data/CHANGELOG.md
CHANGED
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?
|
data/lib/rspec/openapi/hooks.rb
CHANGED
@@ -9,7 +9,7 @@ records = []
|
|
9
9
|
records_errors = []
|
10
10
|
|
11
11
|
RSpec.configuration.after(:each) do |example|
|
12
|
-
if example.metadata[:type]
|
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
|
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.
|
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-
|
11
|
+
date: 2021-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|