<% # @mheap: This is hacky handling for allOf, but it works for now allOf = schema['allOf'] if allOf schema = allOf.reduce { |a,b| a.deep_merge(b) } end %> <% # If it's an array, look at the items for the response schema as all items within # the array are expected to be identical schema = schema['items'] if schema['type'] == 'array' %> <% if schema['properties'] %> <% schema['properties'].each do |key, value| %> <% next if key == '_links' next if value['x-skip-response-description'] parent = "#{endpoint.method}_#{endpoint.path.path.gsub("/", "_")[1..-1]}" unless parent responseFieldId = parent + "_" + key %> class=" Vlt-table__row--noline" <% end %>> <%= key %> <% if value['items'] %>
array of <%= value['items']['type'] %>s <% else %>
<%= value['type'] %> <% end %> <%= value['description'] ? value['description'].render_markdown : '' %> <% if value['enum']%> One of: <%= parameter_values(value['enum']) %> <% end %> <% if value['items'] # If this is an array, we need to show the structure of the children %> <% if value['items']['oneOf'] || value['items']['anyOf'] # If it's a oneOf/anyOf, we need tabs! %> <% if value['items']['oneOf'] qualifier = 'one' key = 'oneOf' else qualifier = 'any' key = 'anyOf' end schemas = value['items'][key].map do |item| if item['allOf'] item = item.deep_merge(item['allOf'].reduce { |a,b| a.deep_merge(b) }) item.delete('allOf') end item end %> <% else %> <% value['properties'] = value['items']['properties'] %> <% schemas = [value] %> <% end %> <% else %> <% schemas = [value] if value['properties'] %> <% end %> <% if schemas %> <% needs_tabs = schemas.size > 1 %> <% if needs_tabs %>
This array contains <%= qualifier %> of the following objects:
<% schemas.each_with_index do |schema, index| %> <% end %>
<% end %> <% schemas.each_with_index do |value, index| %>
<%= erb :'open_api/_response_description_parameters', locals: { endpoint: endpoint, schema: value, parent: responseFieldId } %>
Field Description
<% end %> <% if needs_tabs %>
<% end %> <% end %> <% end %> <% end %>