285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
# File 'lib/betterdocs/generator/swagger.rb', line 285
def add_response_schema(definitions, response)
return nil unless response.full?
subs = {}
resp_cls = get_dto_name(response.representer)
(response.full?(:properties) || []).each do |p|
subs[p.full_name] = p.sub_representer? if p.sub_representer?
sub_cls = get_dto_name(subs[p.nesting_name])
cls = sub_cls || resp_cls
definition = initialise_definition(definitions, cls)
definition[:properties][p.public_name] =
get_schema(p.types, get_dto_name(p.sub_representer?), p.description, p.optional)
end
(response.full?(:links) || []).each do |l|
sub_cls = get_dto_name(subs[l.nesting_name])
add_links_definition(definitions, sub_cls || resp_cls, l.public_name)
end
get_schema_ref(resp_cls)
end
|