acts_as_doc 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/acts_as_doc.gemspec +1 -1
- data/lib/acts_as_doc/response_parser.rb +11 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3e8bfcb1d3cf2a39c36d330d26389fb08739da94a64e92e10f0bee1ba7f191e
|
4
|
+
data.tar.gz: eb4414363b9edbde0995110f8a64e105afa49de8d741bf1dd809b17098452e74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa4efded7868df1dae97a12bf641ea06a155f335b4cf97633677b1514d50218ee2ebf6a01a863fd5b86d61676d15fb9f899186442dddef9b3b4d0d0e35ca155a
|
7
|
+
data.tar.gz: ac811b9e433ea7e54ae943b33162a71b2bfb347c270f223bd5665591dba4e234986063862f48d2ad284d261226aad17e12937b10c469f0afadc0875619ab5120
|
data/acts_as_doc.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# rubocop:disable all
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = "acts_as_doc"
|
4
|
-
s.version = "1.
|
4
|
+
s.version = "1.2.0"
|
5
5
|
s.summary = "Generate swagger response doc"
|
6
6
|
s.description = "Add swagger comment to any ruby file for generating swagger response doc struct"
|
7
7
|
s.authors = ["alex.zang"]
|
@@ -66,15 +66,20 @@ module ActsAsDoc
|
|
66
66
|
matches[1].split(',').each do |attr_name|
|
67
67
|
attr_name.strip!
|
68
68
|
c_type, c_desc = columns[attr_name]
|
69
|
-
self.props_recursion!(hash, "$#{name}.#{attr_name}", c_type, c_desc)
|
69
|
+
self.props_recursion!(hash, "$#{name}.#{attr_name}", c_type, c_desc.to_s)
|
70
70
|
end
|
71
71
|
else
|
72
|
-
hash[name].merge!(type: type, description: desc)
|
72
|
+
hash[name].merge!(type: type, description: desc.to_s)
|
73
73
|
end
|
74
74
|
else
|
75
75
|
nest_hash = hash[name]
|
76
|
-
nest_hash[:
|
77
|
-
|
76
|
+
item_hash = if nest_hash[:type].to_s == 'array'
|
77
|
+
nest_hash[:items] ||= {type: 'object', properties: {}}
|
78
|
+
nest_hash[:items][:properties]
|
79
|
+
else
|
80
|
+
nest_hash[:properties] ||= {}
|
81
|
+
end
|
82
|
+
self.props_recursion!(item_hash, arr.join('.'), type, desc.to_s, klass)
|
78
83
|
end
|
79
84
|
|
80
85
|
hash
|
@@ -107,11 +112,11 @@ module ActsAsDoc
|
|
107
112
|
|
108
113
|
if name.start_with?(':')
|
109
114
|
name = name.sub(/^:/, '')
|
110
|
-
schema[name] = { type: type, description: desc }
|
115
|
+
schema[name] = { type: type, description: desc.to_s }
|
111
116
|
end
|
112
117
|
|
113
118
|
if name.start_with?(REF_FLAG)
|
114
|
-
self.class.props_recursion!(schema, name, type, desc, klass)
|
119
|
+
self.class.props_recursion!(schema, name, type, desc.to_s, klass)
|
115
120
|
end
|
116
121
|
end
|
117
122
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alex.zang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Add swagger comment to any ruby file for generating swagger response
|
14
14
|
doc struct
|