Tungsten v0.1.0 Tungsten.Codegen.Type View Source

Codegen for Type

Link to this section Summary

Types

The any protocol type

The array protocol type, defines the inner type as item_type and optionally defines the minimum and maximum array length

The object protocol type, optionally defining accepted keys

The primitive protocol types for numbers, integers and booleans.

References a named protocol type

The string protocol type, optionally defining accepted values in enum

t()

Link to this section Types

Link to this type

any_type() View Source
any_type() :: %Tungsten.Codegen.Type{
  domain: Tungsten.Codegen.Domain.t(),
  enum: term(),
  item_type: term(),
  max_items: term(),
  min_items: term(),
  properties: term(),
  refers_to: term(),
  spec: map(),
  type: :any
}

The any protocol type

Link to this type

array_type() View Source
array_type() :: %Tungsten.Codegen.Type{
  domain: Tungsten.Codegen.Domain.t(),
  enum: term(),
  item_type:
    reference_type()
    | primitive_type()
    | string_type()
    | object_type()
    | any_type(),
  max_items: pos_integer() | nil,
  min_items: non_neg_integer() | nil,
  properties: term(),
  refers_to: term(),
  spec: map(),
  type: :array
}

The array protocol type, defines the inner type as item_type and optionally defines the minimum and maximum array length

Link to this type

object_type() View Source
object_type() :: %Tungsten.Codegen.Type{
  domain: Tungsten.Codegen.Domain.t(),
  enum: term(),
  item_type: term(),
  max_items: term(),
  min_items: term(),
  properties: [Tungsten.Codegen.Property.t(), ...] | nil,
  refers_to: term(),
  spec: map(),
  type: :object
}

The object protocol type, optionally defining accepted keys

Link to this type

primitive_type() View Source
primitive_type() :: %Tungsten.Codegen.Type{
  domain: Tungsten.Codegen.Domain.t(),
  enum: term(),
  item_type: term(),
  max_items: term(),
  min_items: term(),
  properties: term(),
  refers_to: term(),
  spec: map(),
  type: :number | :integer | :boolean
}

The primitive protocol types for numbers, integers and booleans.

Link to this type

reference_type() View Source
reference_type() :: %Tungsten.Codegen.Type{
  domain: Tungsten.Codegen.Domain.t(),
  enum: term(),
  item_type: term(),
  max_items: term(),
  min_items: term(),
  properties: term(),
  refers_to: {:local | :remote, module(), atom()},
  spec: map(),
  type: :reference
}

References a named protocol type

Link to this type

string_type() View Source
string_type() :: %Tungsten.Codegen.Type{
  domain: Tungsten.Codegen.Domain.t(),
  enum: [{String.t(), atom()}, ...] | nil,
  item_type: term(),
  max_items: term(),
  min_items: term(),
  properties: term(),
  refers_to: term(),
  spec: map(),
  type: :string
}

The string protocol type, optionally defining accepted values in enum

Link to this section Functions