<% model = false if model.nil? callback = false if callback.nil? format = nil if format.nil? unless defined?(parent) parent = "" else parent = "#{parent}." end isOneOf = false unless defined?(isOneOf) %> <% parameters.each do |parameter| %>
<% if parent.blank? %> <%= parameter.name %> <% else %>
<%= parameter.name %>
<% end %> <% if @specification.formats.any? %> <% if @specification.formats.include?('text/xml') %> <% if parameter.is_xml_attribute? %> | Attribute <% end %> <% if parameter.is_xml_text? %> | Value <% end %> <% end %> <% end %>
<%= parameter.type %> <% if parameter.format %> (<%= parameter.format %>) <% end %> <% if parameter.array? %> <% if parameter.items && parameter.items['type'] %> of <%= (parameter.items['type']) %>s <% end %> <% end %> <% if parameter.required and parameter.type %>|<% end %> <% if parameter.required %> Required <% end %> <% if parameter.minimum || parameter.raw['minLength'] %> | Min: <%= parameter.minimum || parameter.raw['minLength'] %> <% end %> <% if parameter.maximum || parameter.raw['maxLength'] %> | Max: <%= parameter.maximum || parameter.raw['maxLength'] %> <% end %> <% if parameter.default || parameter.raw['default'] %> | Default: <%= parameter.default || parameter.raw['default'] %> <% end %> <% if parameter.raw['deprecated'] %> | DEPRECATED : This field has been deprecated. <% end %> <% if parameter.raw['x-replace-with']%> <%= 'Please use ' + ''+ parameter.raw['x-replace-with'] + '' + ' instead.' %> <% end %>
<%= (parameter.description || parameter.schema['description'] || '').render_markdown %> <% if parameter.enum %> <%= (callback || model) ? "One of:" : "Must be one of:" %> <%= parameter_values(parameter.enum) %> <% end %>
<% if parameter.array? && parameter.items && parameter.items['oneOf'] %> <% # Handle specific case - an array that contains a oneOf params = parameter.items['oneOf'].map do |p| p['format'] = parameter.format OasParser::Parameter.new(self, p) end %>
<%= erb :'open_api/_tabbed_single_parameter', locals: { parent: "#{parameter.name}[]", parameters: params, format: format, callback: callback } %>
<% end %> <% if parameter.array? && parameter.items && !parameter.items['oneOf'] %> <% # mheap: We only want to recurse if there are example properties in the array definition if parameter.items['type'] && parameter.items['type'] == 'object' && parameter.items['properties'] %>
<%= erb :'open_api/_parameters', locals: { parent: "#{parent}#{parameter.name}[]", parameters: parameter.properties, model: model, format: format, callback: callback } %>
<% end %> <% end %> <% if parameter.properties && parameter.object? && parameter.properties.size.positive? %>
<%= erb :'open_api/_parameters', locals: { parent: "#{parent}#{parameter.name}", parameters: parameter.properties, model: model, format: format, callback: callback } %>
<% end %>
<% end %>