View Source JsonSchema.Types.EnumType (json_schema v0.5.0)

Represents a custom enum type definition in a JSON schema.

JSON Schema:

"color": {
  "description": "A set of colors",
  "default": "green",
  "type": "string",
  "enum": ["none", "green", "orange", "blue", "yellow", "red"]
}

Resulting in the Elixir representation:

%EnumType{name: "color",
          description: "A set of colors",
          "default": "green",
          path: URI.parse("#/color"),
          type: "string",
          values: ["none", "green", "orange",
                   "blue", "yellow", "red"]}

Link to this section Summary

Link to this section Types

@type t() :: %JsonSchema.Types.EnumType{
  default: value_type() | nil,
  description: String.t() | nil,
  name: String.t() | :anonymous,
  path: URI.t(),
  type: value_type_name() | nil,
  values: [value_type()]
}
@type value_type() :: String.t() | number() | integer()
@type value_type_name() :: :integer | :number | :string