Method: Fdoc::EndpointPresenter#example_from_array

Defined in:
lib/fdoc/presenters/endpoint_presenter.rb

#example_from_array(array) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/fdoc/presenters/endpoint_presenter.rb', line 139

def example_from_array(array)
  if array["items"].kind_of? Array
    example = []
    array["items"].each do |item|
      example << example_from_schema(item)
    end
    example
  elsif (array["items"] || {})["type"].kind_of? Array
    example = []
    array["items"]["type"].each do |item|
      example << example_from_schema(item)
    end
    example
  else
    [ example_from_schema(array["items"]) ]
  end
end