acts_as_doc 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c243f846a2897ead10b45a8db6a13480799563f5f4a204077b937cb96f830305
4
- data.tar.gz: 815d8ca1a8ec5fef03970a566552034b5f160026bc3e06307dbfa486d47d1808
3
+ metadata.gz: d3e8bfcb1d3cf2a39c36d330d26389fb08739da94a64e92e10f0bee1ba7f191e
4
+ data.tar.gz: eb4414363b9edbde0995110f8a64e105afa49de8d741bf1dd809b17098452e74
5
5
  SHA512:
6
- metadata.gz: 70327eca03665679438dd48e9e2f9f17b506b0a4448b50997a6e3e3d06b130c575987390504a302306cc13887a85a4a4077f39eba41bd79ad83d79b6281b2b4a
7
- data.tar.gz: 8d5d2f27ffffdbe9b6519852fa3fa0995f62e64dcd114ff713e365f5ff8d57cb82f5b92a406170e9e545bb1272ec4277bada09e9be5898cd5373eb39d7cc4225
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.1.2"
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[:properties] = {} unless nest_hash.key?(:properties)
77
- self.props_recursion!(nest_hash[:properties], arr.join('.'), type, desc, klass)
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.1.2
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-12 00:00:00.000000000 Z
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