Sha256: d394a02c261032bb63787a19768436c2f96a8b6d52be3334d8f5a6eb1f461211

Contents?: true

Size: 1.99 KB

Versions: 4

Compression:

Stored size: 1.99 KB

Contents

<%
  # @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'] %>
    <tr<% if value['properties'] %> class=" Vlt-table__row--noline" <% end %>>
      <td>
        <b><%= key %></b>
        <% if value['items'] %>
          <br />
          <small>array of <%= value['items']['type'] %>s</small>
        <% else %>
          <br />
          <small>
            <i><%= value['type'] %></i>
          </small>
        <% end %>
      </td>
      <td>
        <%= value['description'] ? value['description'].render_markdown : '' %>
        <% if value['enum']%>
          <small class="Vlt-grey-dark">
            One of: <%= parameter_values(value['enum']) %>
          </small>
        <% end %>

        <% if value['items'] # If this is an array, we need to show the structure of the children %>
          <% value['properties'] = value['items']['properties'] %>
        <% end %>
        <% if value['properties'] %>
            </td>
          </tr>
          <tr class="Vlt-table__row--nohighlight">
            <td colspan="2">
              <div class="Vlt-table Vlt-table--data Vlt-table--bordered">
                <table>
                  <thead>
                    <tr>
                      <th>Field</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <%= erb :'open_api/_response_description_parameters', locals: { schema: value } %>
                  </tbody>
                </table>
              </div>
        <% end %>
      </td>
    </tr>
  <% end %>
<% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nexmo-oas-renderer-0.5.1 lib/nexmo/oas/renderer/views/open_api/_response_description_parameters.erb
nexmo-oas-renderer-0.5.0 lib/nexmo/oas/renderer/views/open_api/_response_description_parameters.erb
nexmo-oas-renderer-0.4.1 lib/nexmo/oas/renderer/views/open_api/_response_description_parameters.erb
nexmo-oas-renderer-0.4.0 lib/nexmo/oas/renderer/views/open_api/_response_description_parameters.erb