View Source OpenAPI.Processor.State (OpenAPI Generator v0.2.0)

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 to OpenAPI.Processor). Callbacks must use this field when calling other process callbacks.
  • operations: Cumulative list of OpenAPI.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 internal refs used to refer to them in types.
  • schema_refs_by_path: Cumulative map of internal refs 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 processed OpenAPI.Processor.Schema.t/0 structs keyed by the internal refs 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.

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

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()
}

Functions

Link to this function

put_new_schema(state, ref, schema)

View Source
@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

Link to this function

put_schema(state, ref, schema)

View Source
@spec put_schema(t(), reference(), OpenAPI.Processor.Schema.t()) :: t()

Add a processed schema to the processor state by its reference

Link to this function

put_schema_spec(state, schema_spec)

View Source
@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