plumbapius v0.13.0 Plumbapius.Response.Schema
Describes the response schema for validation
Link to this section Summary
Functions
Returns a response schema created from a tomogram.
Link to this section Types
Specs
t() :: %Plumbapius.Response.Schema{ body: ExJsonSchema.Schema.Root.t(), content_type: Regex.t() | String.t() | :any_content_type, status: non_neg_integer() }
Response Schema
Link to this section Functions
Link to this function
new(tomogram)
Specs
Returns a response schema created from a tomogram.
Parameters
- tomogram: Description of the response schema as a hash.
Examples
iex> Plumbapius.Response.Schema.new(%{
...> "status" => "200",
...> "content-type" => "application/json",
...> "body" => %{
...> "$schema" => "http://json-schema.org/draft-04/schema#",
...> "type" => "object",
...> "properties" => %{"msisdn" => %{"type" => "number"}},
...> "required" => ["msisdn"]
...> }
...> })
%Plumbapius.Response.Schema{
status: 200,
content_type: "application/json",
body: %ExJsonSchema.Schema.Root{
custom_format_validator: nil,
location: :root,
refs: %{},
schema: %{
"$schema" => "http://json-schema.org/draft-04/schema#",
"type" => "object",
"properties" => %{"msisdn" => %{"type" => "number"}},
"required" => ["msisdn"]
}
}
}