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 +5 -5
- data/CHANGELOG.md +8 -0
- data/README.md +15 -1
- data/lib/oas_objs/header_obj.rb +1 -2
- data/lib/oas_objs/schema_obj.rb +3 -4
- data/lib/open_api/router.rb +5 -1
- data/lib/open_api/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 376358650e9b3247057041cb7dbc985e167201fa
|
4
|
+
data.tar.gz: 5882dd98faaf60b78625367d88f8986db34d7080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/oas_objs/header_obj.rb
CHANGED
data/lib/oas_objs/schema_obj.rb
CHANGED
@@ -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
|
-
|
61
|
-
}
|
59
|
+
value = _addProp.in?([true, false]) ? _addProp : SchemaObj.new(_addProp, { }).process
|
60
|
+
{ additionalProperties: value }
|
62
61
|
end
|
63
62
|
|
64
63
|
def enum
|
data/lib/open_api/router.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/open_api/version.rb
CHANGED
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.
|
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-
|
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.
|
192
|
+
rubygems_version: 2.6.12
|
193
193
|
signing_key:
|
194
194
|
specification_version: 4
|
195
195
|
summary: Concise DSL for generating OpenAPI3 documentation.
|