zero-rails_openapi 1.6.0 → 1.6.1

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: f02e4f2dff6974c8ea59e4e410e695f27d7395a417612003525ed6fa250c008a
4
- data.tar.gz: 23e2eb595a89c71e3f417b295d107de43d9cf5e3af917329715d69fe42846a0f
3
+ metadata.gz: 66b3b5f0baadb63bbc86eee3a1fcfbaf7aae4e6c99accace8d67822416cedef9
4
+ data.tar.gz: 8352e7bd3a917060a60b080ad02f9104ae808c5e78d793cd6daa928fca9eb3b8
5
5
  SHA512:
6
- metadata.gz: de28674280308d143a856a82cdc7fee995b1a506ac4b0342ff9721d3656637f87444c4ff69f4967e8a839e36598797e1559f41a02145c24bce8c823916bc1318
7
- data.tar.gz: ccea172bdb47b90b97f423ac0d6a744e996de455c6fc1a82cf3ba22a12126978e0ff13278d8737ddc4f699065980fb755c2776bf6f98e695598ac74cba357619
6
+ metadata.gz: 54d9f088e61a36f5f7c838a0d4dedffb77d97dabf11fba8077b80af25cf7250ecaf0dd5ff494ab82ba2fdfd59dd3a7b2f4a8356ecbf33e773a6e24c5729d837e
7
+ data.tar.gz: 4674013106338919992c8d03ee59db6ff7158eaaec7f0aa8c4ee0ec97cbd47c41432aeda33bc7205edd27cb47e7a4554ef5eb4fcf5fb1e7f405dd4a79574c614
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.6.1] - 2018/8/21 - [view diff](https://github.com/zhandao/zero-rails_openapi/compare/v1.6.0...v1.6.1)
6
+
7
+ ## Fixed
8
+
9
+ 1. camelize action tag
10
+ 2. update gems cause sprockets vulnerability
11
+
5
12
  ## [1.6.0] - 2018/6/26 - [view diff](https://github.com/zhandao/zero-rails_openapi/compare/v1.5.9...v1.6.0)
6
13
 
7
14
  ## Changed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zero-rails_openapi (1.6.0)
4
+ zero-rails_openapi (1.6.1)
5
5
  activesupport (>= 3)
6
6
  colorize
7
7
  rails (>= 3)
@@ -9,44 +9,48 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (5.1.6)
13
- actionpack (= 5.1.6)
12
+ actioncable (5.2.1)
13
+ actionpack (= 5.2.1)
14
14
  nio4r (~> 2.0)
15
- websocket-driver (~> 0.6.1)
16
- actionmailer (5.1.6)
17
- actionpack (= 5.1.6)
18
- actionview (= 5.1.6)
19
- activejob (= 5.1.6)
15
+ websocket-driver (>= 0.6.1)
16
+ actionmailer (5.2.1)
17
+ actionpack (= 5.2.1)
18
+ actionview (= 5.2.1)
19
+ activejob (= 5.2.1)
20
20
  mail (~> 2.5, >= 2.5.4)
21
21
  rails-dom-testing (~> 2.0)
22
- actionpack (5.1.6)
23
- actionview (= 5.1.6)
24
- activesupport (= 5.1.6)
22
+ actionpack (5.2.1)
23
+ actionview (= 5.2.1)
24
+ activesupport (= 5.2.1)
25
25
  rack (~> 2.0)
26
26
  rack-test (>= 0.6.3)
27
27
  rails-dom-testing (~> 2.0)
28
28
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (5.1.6)
30
- activesupport (= 5.1.6)
29
+ actionview (5.2.1)
30
+ activesupport (= 5.2.1)
31
31
  builder (~> 3.1)
32
32
  erubi (~> 1.4)
33
33
  rails-dom-testing (~> 2.0)
34
34
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- activejob (5.1.6)
36
- activesupport (= 5.1.6)
35
+ activejob (5.2.1)
36
+ activesupport (= 5.2.1)
37
37
  globalid (>= 0.3.6)
38
- activemodel (5.1.6)
39
- activesupport (= 5.1.6)
40
- activerecord (5.1.6)
41
- activemodel (= 5.1.6)
42
- activesupport (= 5.1.6)
43
- arel (~> 8.0)
44
- activesupport (5.1.6)
38
+ activemodel (5.2.1)
39
+ activesupport (= 5.2.1)
40
+ activerecord (5.2.1)
41
+ activemodel (= 5.2.1)
42
+ activesupport (= 5.2.1)
43
+ arel (>= 9.0)
44
+ activestorage (5.2.1)
45
+ actionpack (= 5.2.1)
46
+ activerecord (= 5.2.1)
47
+ marcel (~> 0.3.1)
48
+ activesupport (5.2.1)
45
49
  concurrent-ruby (~> 1.0, >= 1.0.2)
46
50
  i18n (>= 0.7, < 2)
47
51
  minitest (~> 5.1)
48
52
  tzinfo (~> 1.1)
49
- arel (8.0.0)
53
+ arel (9.0.0)
50
54
  builder (3.2.3)
51
55
  colorize (0.8.1)
52
56
  concurrent-ruby (1.0.5)
@@ -56,7 +60,7 @@ GEM
56
60
  erubi (1.7.1)
57
61
  globalid (0.4.1)
58
62
  activesupport (>= 4.2.0)
59
- i18n (1.0.0)
63
+ i18n (1.1.0)
60
64
  concurrent-ruby (~> 1.0)
61
65
  json (2.1.0)
62
66
  loofah (2.2.2)
@@ -64,39 +68,43 @@ GEM
64
68
  nokogiri (>= 1.5.9)
65
69
  mail (2.7.0)
66
70
  mini_mime (>= 0.1.1)
71
+ marcel (0.3.2)
72
+ mimemagic (~> 0.3.2)
67
73
  method_source (0.9.0)
68
- mini_mime (1.0.0)
74
+ mimemagic (0.3.2)
75
+ mini_mime (1.0.1)
69
76
  mini_portile2 (2.3.0)
70
77
  minitest (5.11.3)
71
- nio4r (2.3.0)
72
- nokogiri (1.8.2)
78
+ nio4r (2.3.1)
79
+ nokogiri (1.8.4)
73
80
  mini_portile2 (~> 2.3.0)
74
- rack (2.0.4)
75
- rack-test (1.0.0)
81
+ rack (2.0.5)
82
+ rack-test (1.1.0)
76
83
  rack (>= 1.0, < 3)
77
- rails (5.1.6)
78
- actioncable (= 5.1.6)
79
- actionmailer (= 5.1.6)
80
- actionpack (= 5.1.6)
81
- actionview (= 5.1.6)
82
- activejob (= 5.1.6)
83
- activemodel (= 5.1.6)
84
- activerecord (= 5.1.6)
85
- activesupport (= 5.1.6)
84
+ rails (5.2.1)
85
+ actioncable (= 5.2.1)
86
+ actionmailer (= 5.2.1)
87
+ actionpack (= 5.2.1)
88
+ actionview (= 5.2.1)
89
+ activejob (= 5.2.1)
90
+ activemodel (= 5.2.1)
91
+ activerecord (= 5.2.1)
92
+ activestorage (= 5.2.1)
93
+ activesupport (= 5.2.1)
86
94
  bundler (>= 1.3.0)
87
- railties (= 5.1.6)
95
+ railties (= 5.2.1)
88
96
  sprockets-rails (>= 2.0.0)
89
97
  rails-dom-testing (2.0.3)
90
98
  activesupport (>= 4.2.0)
91
99
  nokogiri (>= 1.6)
92
100
  rails-html-sanitizer (1.0.4)
93
101
  loofah (~> 2.2, >= 2.2.2)
94
- railties (5.1.6)
95
- actionpack (= 5.1.6)
96
- activesupport (= 5.1.6)
102
+ railties (5.2.1)
103
+ actionpack (= 5.2.1)
104
+ activesupport (= 5.2.1)
97
105
  method_source
98
106
  rake (>= 0.8.7)
99
- thor (>= 0.18.1, < 2.0)
107
+ thor (>= 0.19.0, < 2.0)
100
108
  rake (10.5.0)
101
109
  rspec (3.7.0)
102
110
  rspec-core (~> 3.7.0)
@@ -116,7 +124,7 @@ GEM
116
124
  json (>= 1.8, < 3)
117
125
  simplecov-html (~> 0.10.0)
118
126
  simplecov-html (0.10.2)
119
- sprockets (3.7.1)
127
+ sprockets (3.7.2)
120
128
  concurrent-ruby (~> 1.0)
121
129
  rack (> 1, < 3)
122
130
  sprockets-rails (3.2.1)
@@ -127,7 +135,7 @@ GEM
127
135
  thread_safe (0.3.6)
128
136
  tzinfo (1.2.5)
129
137
  thread_safe (~> 0.1)
130
- websocket-driver (0.6.5)
138
+ websocket-driver (0.7.0)
131
139
  websocket-extensions (>= 0.1.0)
132
140
  websocket-extensions (0.1.3)
133
141
 
@@ -142,4 +150,4 @@ DEPENDENCIES
142
150
  zero-rails_openapi!
143
151
 
144
152
  BUNDLED WITH
145
- 1.16.1
153
+ 1.16.3
data/README.md CHANGED
@@ -697,7 +697,7 @@
697
697
  ### Trick1 - Write the DSL Somewhere Else
698
698
 
699
699
  Does your documentation take too many lines?
700
- Do you want to separate documentation from business controller to simplify both?
700
+ Do you want to separate documentation from controller to simplify both?
701
701
  Very easy! Just follow
702
702
 
703
703
  ```ruby
@@ -722,8 +722,14 @@
722
722
  end
723
723
  ```
724
724
 
725
- Notes: file name ends in `_doc.rb` by default, but you can change via `Config.doc_location`
726
- (it should be file paths, defaults to `./app/**/*_doc.rb`).
725
+ Explain: These four steps are necessary:
726
+ 1. create a class, like ApiDoc, and make it include OpenApi::DSL (then it could be the base class for writing Api spec).
727
+ 2. set the specified Api spec's base_doc_class to ApiDoc.
728
+ 3. let your doc class (like V1::ExamplesDoc) inherit the base_doc_class (ApiDoc).
729
+ 4. set the route_base (to route path api/v1/examples of that controller Api::V1::ExamplesController) inside V1::ExamplesDoc.
730
+
731
+ Notes: file name ends in `_doc.rb` by default, but you can change it by setting `Config.doc_location`
732
+ (it should be file paths, defaults to `./app/**/*_doc.rb`).
727
733
 
728
734
  ### Trick2 - Global DRYing
729
735
 
@@ -13,7 +13,8 @@ module OpenApi
13
13
  self.processed = { description: desc }
14
14
  end
15
15
 
16
- def add_or_fusion(media_type, hash)
16
+ def add_or_fusion(desc, media_type, hash)
17
+ self.processed[:description] = desc if desc.present?
17
18
  media_types << MediaTypeObj.new(media_type, hash)
18
19
  self
19
20
  end
@@ -29,7 +29,7 @@ module OpenApi
29
29
  # `code`: when defining components, `code` means `component_key`
30
30
  def response code, desc, media_type = nil, data: { }, type: nil
31
31
  self[:responses][code] = ResponseObj.new(desc) unless (self[:responses] ||= { })[code].is_a?(ResponseObj)
32
- self[:responses][code].add_or_fusion(media_type, { data: type || data })
32
+ self[:responses][code].add_or_fusion(desc, media_type, { data: type || data })
33
33
  end
34
34
 
35
35
  alias_method :resp, :response
data/lib/open_api/dsl.rb CHANGED
@@ -42,7 +42,7 @@ module OpenApi
42
42
  return puts ' ZRO'.red + " Route mapping failed: #{action_path}" if routes.blank?
43
43
 
44
44
  api = Api.new(action_path, skip: Array(skip), use: Array(use))
45
- .merge! description: '', summary: summary, operationId: id || "#{@doc_info[:tag][:name]}_#{action}",
45
+ .merge! description: '', summary: summary, operationId: id || "#{@doc_info[:tag][:name]}#{action.capitalize}",
46
46
  tags: [@doc_tag], parameters: [ ], requestBody: '', responses: { }, callbacks: { },
47
47
  links: { }, security: [ ], servers: [ ]
48
48
  [action, :all].each { |blk_key| @zro_dry_blocks&.[](blk_key)&.each { |blk| api.instance_eval(&blk) } }
@@ -1,3 +1,3 @@
1
1
  module OpenApi
2
- VERSION = '1.6.0'
2
+ VERSION = '1.6.1'
3
3
  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: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - zhandao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-26 00:00:00.000000000 Z
11
+ date: 2018-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  version: '0'
180
180
  requirements: []
181
181
  rubyforge_project:
182
- rubygems_version: 2.7.3
182
+ rubygems_version: 2.7.6
183
183
  signing_key:
184
184
  specification_version: 4
185
185
  summary: Concise DSL for generating OpenAPI3 documentation.