rspec-openapi 0.4.6 → 0.4.7

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: f83672f313f4451abb668adf66697c74be2d0ad7866c6fbc433b2ef815e06419
4
- data.tar.gz: 696c074c32d5ec4f6dfc0f5ea2ab02f9123a4b88a8ce7d09a4c8aada60fe1b6f
3
+ metadata.gz: 91fc5996b0273d0dd4a7e0261b86902db52e7a64c1433bbcb8cf107abf5d3784
4
+ data.tar.gz: 342051d1e3b6bb7a81af2f46fbb75b4c99658bf9cb075359104b6e2feef09985
5
5
  SHA512:
6
- metadata.gz: 232765a27c157fdbb1bd479b14987d095c0fce190e3b76cc10a4f8f3b990c253456af15a79924be632daaf0d08254e934b9da00f24c9779f4f9c4531b3f36bae
7
- data.tar.gz: fbf0fb968a2d1afde12566cc472bb72a97b800101e60c640c1b7fa218a5563f993f48070532af6903c0cf1432a4142fd08235c1e9b6443847e5c2e4b6b22dfdb
6
+ metadata.gz: 0445f41450ef4cfa70548431356aea9dc94abe0a18a6b5132398f63db7c5c46eaf1a572ee41cdf234ed864d0aba490a51abfb36859edc637f4098c32c8ef39c1
7
+ data.tar.gz: 5b318c2f1bec7f0608b89ab6cda871f4dddf6e8e2a2c7bd6dfed8430bb28597b97733bb34f1e03ee5fa0100170fedb0e47545b082b787e24e22e0e98a471591b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v0.4.7
2
+
3
+ * Add `info` config hash
4
+ [#43](https://github.com/k0kubun/rspec-openapi/pull/43)
5
+
1
6
  ## v0.4.6
2
7
 
3
8
  * Fix "No route matched for" error in engine routes
data/README.md CHANGED
@@ -126,6 +126,15 @@ RSpec::OpenAPI.enable_example = false
126
126
  # Change `info.version`
127
127
  RSpec::OpenAPI.application_version = '1.0.0'
128
128
 
129
+ # Set the info header details
130
+ RSpec::OpenAPI.info = {
131
+ description: 'My beautiful API',
132
+ license: {
133
+ 'name': 'Apache 2.0',
134
+ 'url': 'https://www.apache.org/licenses/LICENSE-2.0.html'
135
+ }
136
+ }
137
+
129
138
  # Set `headers` - generate parameters with headers for a request
130
139
  RSpec::OpenAPI.request_headers = %w[X-Authorization-Token]
131
140
 
@@ -20,7 +20,9 @@ RSpec.configuration.after(:suite) do
20
20
  title = File.basename(Dir.pwd)
21
21
  path_records.each do |path, records|
22
22
  RSpec::OpenAPI::SchemaFile.new(path).edit do |spec|
23
- RSpec::OpenAPI::SchemaMerger.reverse_merge!(spec, RSpec::OpenAPI::DefaultSchema.build(title))
23
+ schema = RSpec::OpenAPI::DefaultSchema.build(title)
24
+ schema[:info].merge!(RSpec::OpenAPI.info)
25
+ RSpec::OpenAPI::SchemaMerger.reverse_merge!(spec, schema)
24
26
  records.each do |record|
25
27
  begin
26
28
  RSpec::OpenAPI::SchemaMerger.reverse_merge!(spec, RSpec::OpenAPI::SchemaBuilder.build(record))
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module OpenAPI
3
- VERSION = '0.4.6'
3
+ VERSION = '0.4.7'
4
4
  end
5
5
  end
data/lib/rspec/openapi.rb CHANGED
@@ -6,12 +6,13 @@ module RSpec::OpenAPI
6
6
  @comment = nil
7
7
  @enable_example = true
8
8
  @description_builder = -> (example) { example.description }
9
+ @info = {}
9
10
  @application_version = '1.0.0'
10
11
  @request_headers = []
11
12
  @server_urls = []
12
13
  @example_types = %i[request]
13
14
 
14
15
  class << self
15
- attr_accessor :path, :comment, :enable_example, :description_builder, :application_version, :request_headers, :server_urls, :example_types
16
+ attr_accessor :path, :comment, :enable_example, :description_builder, :info, :application_version, :request_headers, :server_urls, :example_types
16
17
  end
17
18
  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.6
4
+ version: 0.4.7
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-24 00:00:00.000000000 Z
11
+ date: 2022-03-26 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.1.2
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