View Source OpenAPI.State (OpenAPI Generator v0.1.0-rc.4)

State for the overall code generation

This struct contains data that is passed between phases of the generation. It includes the following fields:

  • call: Information about the original call to the generator, including the configuration profile and the spec files passed.
  • files: After the render phase, contains a list of OpenAPI.Renderer.File.t/0 structs that were written.
  • operations: After the process phase, contains a list of OpenAPI.Processor.Operation.t/0 structs that were processed.
  • schemas: After the process phase, contains a map of schema references to their OpenAPI.Processor.Schema.t/0 structs. The reference-keyed map is included to make it easier for render callbacks to look up a schema by its reference, as this is often how operations will refer to them.
  • schema_specs_by_path: After the read phase, contains a map of all schema specs keyed on their base file and last referenced paths. This allows for easy lookup of schema specs from OpenAPI.Spec.ref/0 references.
  • spec: After the read phase, contains the parsed and merged OpenAPI description(s).

All of this state is managed by the code generator between phases, and it is unlikely that a callback would need to read or write to this struct directly.

Link to this section Summary

Types

t()

OpenAPI generator state

Raw Yaml input.

Link to this section Types

@type t() :: %OpenAPI.State{
  call: OpenAPI.Call.t(),
  files: [OpenAPI.Renderer.File.t()],
  operations: [OpenAPI.Processor.Operation.t()],
  schema_specs_by_path: %{
    required(OpenAPI.Spec.full_path()) => OpenAPI.Spec.Schema.t()
  },
  schemas: %{required(reference()) => OpenAPI.Processor.Schema.t()},
  spec: OpenAPI.Spec.t() | nil
}

OpenAPI generator state

@type yaml() :: map() | list()

Raw Yaml input.