zero-rails_openapi 2.1.1 → 2.1.2

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
- SHA256:
3
- metadata.gz: 3b19a052b847ba122b75b0b0fb1ecfa401c087a111fa18a7129b0553496298eb
4
- data.tar.gz: 9baa8e072b95a4da0dae09c6538e6172d509231361806ee1613a066ec4d0fd81
2
+ SHA1:
3
+ metadata.gz: 376358650e9b3247057041cb7dbc985e167201fa
4
+ data.tar.gz: 5882dd98faaf60b78625367d88f8986db34d7080
5
5
  SHA512:
6
- metadata.gz: 4166f08378b66d7a80d7c26d2b893688e5c19f74cc8352eaf6e2a8f1217bbd2f9910285dc2d941193e0ea4fc10d8cf3270012c0491fb1583ae1282e28058e955
7
- data.tar.gz: 315db1cf5d4cb569071f01fab825076157eb42d8b7261a6d131ddf22aae75c63fa7f5b6cc5b4d9309332a0bf57ab92c4d3e364749522be082b8e45902a9fbf73
6
+ metadata.gz: fd6cb340ea211eab201d345af76c24ba78ce50163cbb3fbf931b5346715fa1e91a456012012bb9a5e8371d9ebfd02c22869d9f55a1489e2ed94b2b794073592a
7
+ data.tar.gz: 07e35bb9ef18e94e5b1a21e71cc32db95671ef862ca865be797f6ed3ff29842a3a836f91be268d57618a73edcc53c0c11390f756031474f059c78cd24fe9ce1f
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [2.1.1 - 2.1.2] - 2019/2/12 - [view diff](https://github.com/zhandao/zero-rails_openapi/compare/v2.1.0...v2.1.2)
6
+
7
+ ### Fixed
8
+
9
+ 1. Fix response header schema output [PR #49 by @drjonnicholson](https://github.com/zhandao/zero-rails_openapi/pull/49)
10
+ 2. Fix router formatter in Rails 6 [PR #53 by @rjayroach](https://github.com/zhandao/zero-rails_openapi/pull/53)
11
+ 3. Support for generating `additional_properties: true` [issued by @bopm](https://github.com/zhandao/zero-rails_openapi/issues/55)
12
+
5
13
  ## [2.1.0] - 2019/2/16 - [view diff](https://github.com/zhandao/zero-rails_openapi/compare/v2.0.3...v2.1.0)
6
14
 
7
15
  See: [PR #43](https://github.com/zhandao/zero-rails_openapi/pull/43)
data/README.md CHANGED
@@ -121,6 +121,20 @@
121
121
 
122
122
  ### Part 2: config (DSL) for generating OpenApi info
123
123
 
124
+ ```ruby
125
+ # 1. open_api
126
+ # base_doc_classes should be an array of base classes of the classes you write the OpenApi spec in,
127
+ # like [ActionController::Base] (if you write spec in controllers).
128
+ open_api doc_name, base_doc_classes: []
129
+
130
+ # 2. info
131
+ info version:, title:, desc: '', **addition
132
+
133
+ # 3. server
134
+ # 4. security_scheme / base_auth / bearer_auth / api_key
135
+ # 5. global_security_require
136
+ ```
137
+
124
138
  See all the DSLs: [config_dsl.rb](lib/open_api/config_dsl.rb)
125
139
 
126
140
  ## DSL Usage
@@ -238,7 +252,7 @@
238
252
  end
239
253
  ```
240
254
 
241
- And then you should call `dry` method ([detailed info]()) for executing the declared dry blocks:
255
+ And then you should call `dry` method ([detailed info](#9-dry)) for executing the declared dry blocks:
242
256
  ```ruby
243
257
  api :index do
244
258
  dry
@@ -16,8 +16,7 @@ module OpenApi
16
16
  end
17
17
 
18
18
  def process
19
- schema.process
20
- processed.merge!(schema: schema)
19
+ processed.merge!(schema: schema.process)
21
20
  end
22
21
  end
23
22
  end
@@ -46,7 +46,7 @@ module OpenApi
46
46
  { type: 'string', format: Config.file_format }
47
47
  elsif t == 'datetime'
48
48
  { type: 'string', format: 'date-time' }
49
- elsif t[/\{=>.*\}/]
49
+ elsif t[/{=>.*}/]
50
50
  self[:values_type] = t[3..-2]
51
51
  { type: 'object' }
52
52
  else # other string
@@ -56,9 +56,8 @@ module OpenApi
56
56
 
57
57
  def additional_properties
58
58
  return if processed[:type] != 'object' || _addProp.nil?
59
- {
60
- additionalProperties: SchemaObj.new(_addProp, { }).process
61
- }
59
+ value = _addProp.in?([true, false]) ? _addProp : SchemaObj.new(_addProp, { }).process
60
+ { additionalProperties: value }
62
61
  end
63
62
 
64
63
  def enum
@@ -15,7 +15,11 @@ module OpenApi
15
15
  all_routes = Rails.application.routes.routes
16
16
  require 'action_dispatch/routing/inspector'
17
17
  inspector = ActionDispatch::Routing::RoutesInspector.new(all_routes)
18
- inspector.format(ActionDispatch::Routing::ConsoleFormatter.new, nil)
18
+ if Rails::VERSION::MAJOR < 6
19
+ inspector.format(ActionDispatch::Routing::ConsoleFormatter.new, nil)
20
+ else
21
+ inspector.format(ActionDispatch::Routing::ConsoleFormatter::Sheet.new)
22
+ end
19
23
  # :nocov:
20
24
  end
21
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenApi
4
- VERSION = '2.1.1'
4
+ VERSION = '2.1.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zero-rails_openapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - zhandao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-03 00:00:00.000000000 Z
11
+ date: 2019-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  version: '0'
190
190
  requirements: []
191
191
  rubyforge_project:
192
- rubygems_version: 2.7.3
192
+ rubygems_version: 2.6.12
193
193
  signing_key:
194
194
  specification_version: 4
195
195
  summary: Concise DSL for generating OpenAPI3 documentation.