211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
# File 'lib/betterdocs/generator/swagger.rb', line 211
def get_type(types)
type = types
nullable = false
if types.instance_of? Array
case types.length
when 0
type = nil
when 1
type = types[0]
else
types.each do |t|
if t == 'null'
nullable = true
else
type = t
end
end
end
end
unless %w[integer number string boolean array object].include?(type)
puts "Warning: invalid type #{type || 'nil'}"
end
[type, nullable]
end
|