View Source OpenAPI.Processor.Type (OpenAPI Generator v0.4.0)
Summary
Types
Literal values, as found in const and enum definitions
Basic type
Internal representation of types
Unnatural types introduced by the generator
Functions
Create an internal type representation of the given schema
Types
Literal values, as found in const and enum definitions
@type primitive() :: :boolean | {:boolean, format :: String.t()} | :integer | {:integer, format :: String.t()} | :number | {:number, format :: String.t()} | :string | {:string, format :: String.t()} | :null
Basic type
These types represent a subset of the six primitive values defined by JSON schema (omitting
object and array, which are represented in t/0.) Note that both integer and number are
acceptable types, with the latter covering both integer and decimal numbers. Types may include
a format string, which provides additional information about how the value is represented.
@type t() :: primitive() | unnatural() | {:array, t()} | {:const, literal()} | {:enum, [literal()]} | {:union, [t()]} | reference()
Internal representation of types
In addition to the primitive/0 types, values can be constants or enums defined by
literal/0 values. They can also be arrays or objects, as well as the union of multiple
type definitions. If a value is nullable, it will be expressed as the union with :null.
Elixir references (reference/0) represent schemas stored in the processor State.
@type unnatural() :: :any | :map
Unnatural types introduced by the generator
These types may be introduced in extra fields or when referenced schemas are ignored.
Functions
@spec from_schema( %OpenAPI.Processor.State{ implementation: term(), operations: term(), profile: term(), schema_refs_by_path: term(), schema_specs_by_path: term(), schema_specs_by_ref: term(), schemas_by_ref: term(), spec: term() }, OpenAPI.Spec.Schema.t() | OpenAPI.Spec.ref() ) :: {OpenAPI.Processor.State.t(), t()}
Create an internal type representation of the given schema
This function supports referencing object schemas in the processor state. As a result, if it encounters an object schema as a sub-field of the given schema, it will potentially modify the processor state in order to stash a new reference.