<% renderer = Nexmo::OAS::Renderer::Presenters::RequestBodyRaw params ||= endpoint.request_body.properties_for_format(format) requests = [] # Only show the required fields tab if there are any required fields required_params = params.select do |param| param.required end requests.push( { 'title' => 'Required Fields Only', 'id' => 'required-only', 'value' => renderer.new(params, { 'required_only' => true }, endpoint) }) if required_params.any? # Always show the all fields tab requests.push( { 'title' => 'All Fields', 'id' => 'all-fields', 'value' => renderer.new(params, { 'required_only' => false }, endpoint) } ) # Remove the "required only" option if the two request bodies are identical unique_requests = requests.map { |r| r['value'].to_format('application/json') }.to_set.size requests.shift if (unique_requests == 1 && requests.size != unique_requests) title = "Example Request" unless title if defined?(subtitle) title = "#{title} » #{subtitle}" end %>

<%= title %>

<% requests.each_with_index do |request, index| %> <% end %>
<% requests.each_with_index do |request, index| %>
<%= request['value'].to_format(format) %>
<% end %>