PhoenixSwagger.Schema.items
You're seeing just the function
items
, go back to PhoenixSwagger.Schema module for more information.
Sets the schema/s for the items of an array.
Use a single schema for arrays when each item should have the same schema.
Use a list of schemas when the array represents a tuple, each element will be validated against
the corresponding schema in the items
list.
Examples
iex> alias PhoenixSwagger.Schema
...> %Schema{type: :array}
...> |> Schema.items(%Schema{type: :string})
%PhoenixSwagger.Schema{type: :array, items: %PhoenixSwagger.Schema{type: :string}}
iex> alias PhoenixSwagger.Schema
...> %Schema{type: :array}
...> |> Schema.items([%Schema{type: :string}, %Schema{type: :number}])
%PhoenixSwagger.Schema{
type: :array,
items: [%PhoenixSwagger.Schema{type: :string}, %PhoenixSwagger.Schema{type: :number}]
}