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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84a468753835af1c1f73d8edf468234bd164283c67b18a0f1a4281bea905fc86
4
- data.tar.gz: 498222082962d5a7376994cdde490ea64d03440a1a1487b568a9fc9cad6c0d38
3
+ metadata.gz: 69e3e4d92a82219b4e70f108f1d7ba407c5faa1dc90b7e123c7d69021cd7f4e7
4
+ data.tar.gz: a106cb419fba57a5dd448f0625c80ffdf90b9cc329b98bfd0a2e908a1cf1c2c8
5
5
  SHA512:
6
- metadata.gz: 7965992ef4dc0b7464b1742a261a668d1793343bee96d876d3b9771328d54dc97740db4df2fafe9f2b8848c2eed7e45d931503e6c19a896a846cbfc5cb2e4e16
7
- data.tar.gz: 951e8fc0ac3c327979e8bf2d53c32dcaef6fda75aafb3b7e4e2815695ff72261feda7234ec64f40ee99234156194f5a1973cb8cd141dcdc4879c69cec0d06821
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.0"
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-zA-Z]+)\)$/))
53
+ if klass && (matches = desc.match(/^\(([a-z,\s_A-Z]+)\)$/))
54
54
  columns = Object.const_get(klass).columns.map do |column|
55
- [ column.name.to_s, [TYPE_MAPPER[column.type], column.comment] ]
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'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - alex.zang