View Source OpenAPI.Processor.State (OpenAPI Generator v0.1.1)
State of the process phase of code generation
This struct is created at the beginning of the process phase using data from the overall
generator OpenAPI.State
. It has the following fields:
implementation
: Module configured as the implementation of the processor (defaults toOpenAPI.Processor
). Callbacks must use this field when calling other process callbacks.operations
: Cumulative list ofOpenAPI.Processor.Operation.t/0
structs identified and processed so far.profile
: Name of the active configuration profile. Callbacks must use this field when looking up configuration from the application environment.schema_specs_by_path
: Map of raw schema specifications keyed by the original paths where they could be found in the spec files, as provided by the read phase. This map may include schemas that are not used in operations.schema_specs_by_ref
: Cumulative map of raw schema specifications keyed by the internalref
s used to refer to them in types.schema_refs_by_path
: Cumulative map of internalref
s used to refer to schemas keyed by the original paths where they could be found in the spec files.schemas_by_ref
: Cumulative map of processedOpenAPI.Processor.Schema.t/0
structs keyed by the internalref
s used to refer to them in types, as they are processed.spec
: The original parsed OpenAPI description.
All of this data is managed by the code generator, and it is unlikely that a callback would need to transform this struct directly.
Link to this section Summary
Functions
Add a processed schema to the processor state by its reference only if is is not already present
Add a processed schema to the processor state by its reference
Add a schema spec to the processor state and generate a reference for it
Link to this section Types
@type t() :: %OpenAPI.Processor.State{ implementation: module(), operations: [OpenAPI.Processor.Operation.t()], profile: atom(), schema_refs_by_path: %{required(term()) => reference()}, schema_specs_by_path: term(), schema_specs_by_ref: %{required(reference()) => OpenAPI.Spec.Schema.t()}, schemas_by_ref: %{required(reference()) => OpenAPI.Processor.Schema.t()}, spec: OpenAPI.Spec.t() }
Link to this section Functions
@spec put_new_schema(t(), reference(), OpenAPI.Processor.Schema.t()) :: t()
Add a processed schema to the processor state by its reference only if is is not already present
@spec put_schema(t(), reference(), OpenAPI.Processor.Schema.t()) :: t()
Add a processed schema to the processor state by its reference
@spec put_schema_spec(t(), OpenAPI.Spec.Schema.t()) :: {t(), reference()}
Add a schema spec to the processor state and generate a reference for it