Sha256: 126c2e4a960c80da7df3da476b1bea469ff1bd8bc6d1ee04bd3319e70a7a8cdb

Contents?: true

Size: 1.22 KB

Versions: 8

Compression:

Stored size: 1.22 KB

Contents

<%
  # Handle any cases where the top level of the oneOf is an allOf
  schemas = schema.map do |s|
    if s['allOf']
      newSchema = body.handle_all_of(s)
      s.each do |k,v|
        newSchema[k] = v
      end

      next newSchema
    end
    s
  end

  switcher = Nexmo::OAS::Renderer::Presenters::ContentSwitcher.new(label: "Request Details", format: format, force_type: request['x-switcher'], theme_light: @theme_light)

  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


    if schema['oneOf']
      content = (erb :'open_api/_tabbed_parameters', locals: { body: body, request: schema, schema: schema['oneOf'], format: format, callback: callback })
    else
      content = (erb :'open_api/_parameters', locals: { parameters: schema['properties'], callback: callback })
    end

    switcher.add_content(
      title: schema['title'] || schema['description'],
      content: content,
      tab_id: schema['x-tab-id'],
      active: index == 0
    )
  end
%>

<%= erb *switcher.render %>

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nexmo-oas-renderer-2.7.2 lib/nexmo/oas/renderer/views/open_api/_tabbed_parameters.erb
nexmo-oas-renderer-2.7.1 lib/nexmo/oas/renderer/views/open_api/_tabbed_parameters.erb
nexmo-oas-renderer-2.7.0 lib/nexmo/oas/renderer/views/open_api/_tabbed_parameters.erb
nexmo-oas-renderer-2.6.0 lib/nexmo/oas/renderer/views/open_api/_tabbed_parameters.erb
nexmo-oas-renderer-2.5.0 lib/nexmo/oas/renderer/views/open_api/_tabbed_parameters.erb
nexmo-oas-renderer-2.4.1 lib/nexmo/oas/renderer/views/open_api/_tabbed_parameters.erb
nexmo-oas-renderer-2.4.0 lib/nexmo/oas/renderer/views/open_api/_tabbed_parameters.erb
nexmo-oas-renderer-2.3.0 lib/nexmo/oas/renderer/views/open_api/_tabbed_parameters.erb