PhoenixSwagger.Schema.new
You're seeing just the macro
new
, go back to PhoenixSwagger.Schema module for more information.
Construct a new %Schema{} struct using the schema DSL.
This macro is similar to PhoenixSwagger.swagger_schema, except that it produces a Schema struct instead of a plain map with string keys.
Examples
iex> require PhoenixSwagger.Schema, as: Schema
...> Schema.new do
...> type :object
...> properties do
...> name :string, "user name", required: true
...> date_of_birth :string, "date of birth", format: :datetime
...> end
...> end
%Schema{
type: :object,
properties: %{
name: %Schema {
type: :string,
description: "user name"
},
date_of_birth: %Schema {
type: :string,
format: :datetime,
description: "date of birth"
}
},
required: [:name]
}