zero-rails_openapi 1.5.6 → 1.5.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
  SHA1:
3
- metadata.gz: dec6a3ea12a29b24fa6b0ebcedb7ce02ba8e61d9
4
- data.tar.gz: 05c67721c53cbdd173068f1ae9df0d629d97e3aa
3
+ metadata.gz: ed64dbbb343efdc64e8ea606b49e5363f6fcc04a
4
+ data.tar.gz: f6914e5543de926f5672710f9247ccb3b1c1bdbc
5
5
  SHA512:
6
- metadata.gz: 660c9cbc7567fa48f70fe3be7638f221a8c0be88ca3c7ea487d7d12535bc155e8a28834ea7577dfb77d1b9161eacc79a05dc702d2d23913b261512a6e6576a3e
7
- data.tar.gz: 30f0533d1fcdbb05392152f9f742e31501fc196076e946485d679ecd831e280bfaacfc4a33907702c28286e32582f40bb27edadf212bca218b2b613969e793e2
6
+ metadata.gz: 6308ca2b74eee6cd14d2a828eaed6c4591ffd2496e115c1e2c1d0807f7c70b457965f7146738efdb430740eb7a3f95d7fe0991060b4ca2531e18037c14547d5f
7
+ data.tar.gz: 290fcb45ceb1f876ea4b3f20ccdfd4f056be1a5e18a6e534bef63e8d7a7d217e513872ec3bbed827748d2bd258bae69af455102f6dda5a870797a87981c4286c
data/CHANGELOG.md CHANGED
@@ -2,11 +2,22 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.5.7] - 2018/4/6 - [view diff](https://github.com/zhandao/zero-rails_openapi/compare/v1.5.6...v1.5.7)
6
+
7
+ ## Changed
8
+
9
+ 1. issue [#16](#https://github.com/zhandao/zero-rails_openapi/issues/16) DSL in `base_doc_class` can not be generated.
10
+
11
+ ## Fixed
12
+
13
+ 1. issue [#15](#https://github.com/zhandao/zero-rails_openapi/issues/15) colorize was not required.
14
+ 2. securitySchemes defined by config DSL was not be generated.
15
+
5
16
  ## [1.5.6] - 2018/3/23 - [view diff](https://github.com/zhandao/zero-rails_openapi/compare/v1.5.5...v1.5.6)
6
17
 
7
18
  ## Changed
8
19
 
9
- 1. Update `loofah` and `rails-html-sanitizer` cause XSS vulnerability.
20
+ 1. Upgrade `loofah` and `rails-html-sanitizer` cause XSS vulnerability.
10
21
  2. Refactor and document DSL for Rspec (spec_dsl.rb).
11
22
 
12
23
  ## [1.5.5] - 2018/2/21 - [view diff](https://github.com/zhandao/zero-rails_openapi/compare/v1.5.4...v1.5.5)
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zero-rails_openapi (1.5.6)
4
+ zero-rails_openapi (1.5.7)
5
5
  activesupport (>= 3)
6
- colorize (= 0.8.1)
6
+ colorize
7
7
  rails (>= 3)
8
8
 
9
9
  GEM
@@ -53,7 +53,7 @@ GEM
53
53
  crass (1.0.3)
54
54
  diff-lcs (1.3)
55
55
  docile (1.3.0)
56
- erubi (1.7.0)
56
+ erubi (1.7.1)
57
57
  globalid (0.4.1)
58
58
  activesupport (>= 4.2.0)
59
59
  i18n (0.9.5)
@@ -68,11 +68,11 @@ GEM
68
68
  mini_mime (1.0.0)
69
69
  mini_portile2 (2.3.0)
70
70
  minitest (5.11.3)
71
- nio4r (2.2.0)
71
+ nio4r (2.3.0)
72
72
  nokogiri (1.8.2)
73
73
  mini_portile2 (~> 2.3.0)
74
74
  rack (2.0.4)
75
- rack-test (0.8.2)
75
+ rack-test (0.8.3)
76
76
  rack (>= 1.0, < 3)
77
77
  rails (5.1.5)
78
78
  actioncable (= 5.1.5)
data/README.md CHANGED
@@ -6,12 +6,24 @@
6
6
  [![Test Coverage](https://api.codeclimate.com/v1/badges/471fd60f6eb7b019ceed/test_coverage)](https://codeclimate.com/github/zhandao/zero-rails_openapi/test_coverage)
7
7
 
8
8
  Concise DSL for generating OpenAPI Specification 3 (**OAS3**, formerly Swagger3) JSON documentation for Rails application.
9
+
10
+ ```ruby
11
+ class Api::ExamplesController < ApiController
12
+ api :update, 'POST update some thing' do
13
+ path :id, Integer
14
+ query :token, String, desc: 'api token', length: 16
15
+ form data: { phone: String }
16
+ end
17
+ end
18
+ ```
9
19
 
10
20
  ## Contributing
11
21
 
12
22
  **Hi, here is ZhanDao = ▽ =
13
23
  It may be a very useful tool if you want to write API document clearly.
14
24
  I'm looking forward to your issue and PR!**
25
+
26
+ [Need Help](https://github.com/zhandao/zero-rails_openapi/issues/14)
15
27
 
16
28
  If you have any questions, please read the test code first.
17
29
  such as [api DSL](spec/api_spec.rb) and [schema Obj](spec/oas_objs/schema_obj_spec.rb).
data/lib/open_api/dsl.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'open_api/dsl/api'
2
2
  require 'open_api/dsl/components'
3
+ require 'colorize'
3
4
 
4
5
  module OpenApi
5
6
  module DSL
@@ -1,5 +1,6 @@
1
1
  require 'active_support/hash_with_indifferent_access'
2
2
  require 'open_api/config'
3
+ require 'colorize'
3
4
 
4
5
  module OpenApi
5
6
  module Generator
@@ -27,11 +28,12 @@ module OpenApi
27
28
  doc = { openapi: '3.0.0', **settings.slice(:info, :servers) }.merge!(
28
29
  security: settings[:global_security], tags: [ ], paths: { },
29
30
  components: {
30
- securitySchemes: { }, schemas: { }, parameters: { }, requestBodies: { }
31
- }.merge!(settings[:components] || { })
31
+ securitySchemes: settings[:securitySchemes] || { },
32
+ schemas: { }, parameters: { }, requestBodies: { }
33
+ }
32
34
  )
33
35
 
34
- settings[:base_doc_class].descendants.each do |ctrl|
36
+ [(bdc = settings[:base_doc_class]), *bdc.descendants].each do |ctrl|
35
37
  doc_info = ctrl.instance_variable_get('@doc_info')
36
38
  next if doc_info.nil?
37
39
 
@@ -1,3 +1,3 @@
1
1
  module OpenApi
2
- VERSION = '1.5.6'
2
+ VERSION = '1.5.7'
3
3
  end
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency 'rspec', '~> 3.0'
29
29
  spec.add_development_dependency 'simplecov'
30
30
 
31
- spec.add_runtime_dependency 'colorize', '0.8.1'
31
+ spec.add_runtime_dependency 'colorize'
32
32
  spec.add_runtime_dependency 'activesupport', '>= 3'
33
33
  spec.add_runtime_dependency 'rails', '>= 3'
34
34
 
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: 1.5.6
4
+ version: 1.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - zhandao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-23 00:00:00.000000000 Z
11
+ date: 2018-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: colorize
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.8.1
75
+ version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.8.1
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: activesupport
85
85
  requirement: !ruby/object:Gem::Requirement