Sha256: c09c594529b7dfc5ef881db6df096a42699367999d3bcbb07b57f49010514eb3

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

<%
  # Handle any cases where the top level of the oneOf is an allOf
  schemas = schema.map { |s| body.handle_all_of(s) }

  panels = []

  schemas.each_with_index do |schema, index|
    if schema['properties']
      schema['properties'] = schema['properties'].map do |name, definition|
        OasParser::Property.new(self, schema, name, definition)
      end
      .sort_by do |prop|
        prop.required ? -1 : 1
      end
    end

    panels.push({
      'description' => schema['title'] || schema['description'],
      'parameters' => schema['properties'],
      'oneOf' => schema['oneOf'],
      'x-tab-id' => schema['x-tab-id'],
      'active' => index == 0
    })
  end
%>

<div class="Vlt-tabs js-format" data-format="<%= format %>">
  <div class="Vlt-tabs__header" role="tablist" aria-label="Responses">
    <% panels.each do |panel| %>
      <div data-tab-link="<%= panel['x-tab-id'] %>" class="Vlt-tabs__link <%= panel['active'] ? 'Vlt-tabs__link_active' : '' %>">
        <%= panel['description'] %>
      </div>
    <% end %>
  </div>
  <div class="Vlt-tabs__content">
    <% panels.each do |panel| %>
      <div class="Vlt-tabs__panel <%= panel['active'] ? 'Vlt-tabs__panel_active' : '' %>">
      <%
        # Nested oneOf?
        if panel['oneOf']
          %>
          <%= erb :'open_api/_tabbed_parameters', locals: { body: body, schema: panel['oneOf'], format: format, callback: callback } %>
        <%
        else
        %>

        <%= erb :'open_api/_parameters', locals: { parameters: panel['parameters'], callback: callback } %>
      <% end %>
      </div>
    <% end %>
  </div>
</div>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nexmo-oas-renderer-0.8.0 lib/nexmo/oas/renderer/views/open_api/_tabbed_parameters.erb