acts_as_doc 1.1.0 → 1.1.1
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 +10 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69e3e4d92a82219b4e70f108f1d7ba407c5faa1dc90b7e123c7d69021cd7f4e7
|
4
|
+
data.tar.gz: a106cb419fba57a5dd448f0625c80ffdf90b9cc329b98bfd0a2e908a1cf1c2c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98b40a4d13e824f471374dce1514f2edd6170dc792922fb4682b6d262dd9657293249e37e6ecc4dd6b24618d97b8cd16880ce869ade38999613130c0cb242ac5
|
7
|
+
data.tar.gz: 2ffc7d404eb9c0c738d09e5d6b69769bf4255cf750db09bdda7e463d51b5dc0c2f3a7b25a64b674ecdb7cc1dc9ac9212ceff34608a56313d75749642c7e80f10
|
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.1.
|
4
|
+
s.version = "1.1.1"
|
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"]
|
@@ -50,12 +50,18 @@ module ActsAsDoc
|
|
50
50
|
hash[name] = {} unless hash.key?(name)
|
51
51
|
|
52
52
|
if arr.empty?
|
53
|
-
if klass && (matches = desc.match(/^\(([a-
|
53
|
+
if klass && (matches = desc.match(/^\(([a-z,\s_A-Z]+)\)$/))
|
54
54
|
columns = Object.const_get(klass).columns.map do |column|
|
55
|
-
|
55
|
+
column_type = if column.respond_to?(:array?) && column.array?
|
56
|
+
'array'
|
57
|
+
else
|
58
|
+
TYPE_MAPPER[column.type]
|
59
|
+
end
|
60
|
+
[ column.name.to_s, [column_type, column.comment] ]
|
56
61
|
end.to_h
|
57
62
|
|
58
63
|
matches[1].split(',').each do |attr_name|
|
64
|
+
attr_name.strip!
|
59
65
|
c_type, c_desc = columns[attr_name]
|
60
66
|
self.props_recursion!(hash, "$#{name}.#{attr_name}", c_type, c_desc)
|
61
67
|
end
|
@@ -86,10 +92,10 @@ module ActsAsDoc
|
|
86
92
|
if tag == '@prop'
|
87
93
|
desc = arr[3..] ? arr[3..].join(' ') : ''
|
88
94
|
|
89
|
-
matches = type.match(/\[(?<type>[a-zA-Z
|
95
|
+
matches = type.match(/\[(?<type>[a-zA-Z<>:]+)\]/)
|
90
96
|
type = matches ? matches[:type] : 'string'
|
91
97
|
|
92
|
-
klass_matches = type.match(/(?<type>[a-zA-Z]+)<(?<klass>[a-zA-Z]+)>/)
|
98
|
+
klass_matches = type.match(/(?<type>[a-zA-Z]+)<(?<klass>[a-zA-Z:]+)>/)
|
93
99
|
klass = nil
|
94
100
|
if klass_matches
|
95
101
|
type = SUPPORT_TYPES.include?(klass_matches[:type]) ? klass_matches[:type] : 'string'
|