open_api_spex v2.1.1 OpenApiSpex.SchemaResolver View Source

Internal module used to resolve OpenApiSpex.Schema structs from atoms.

Link to this section Summary

Functions

Adds schemas to the api spec from the modules specified in the Operations

Link to this section Functions

Link to this function resolve_schema_modules(spec) View Source
resolve_schema_modules(OpenApiSpex.OpenApi.t()) :: OpenApiSpex.OpenApi.t()

Adds schemas to the api spec from the modules specified in the Operations.

Eg, if the response schema for an operation is defined with:

responses: %{
  200 => Operation.response("User", "application/json", UserResponse)
}

Then the UserResponse.schema() function will be called to load the schema, and a Reference to the loaded schema will be used in the operation response.

See OpenApiSpex.schema macro for a convenient syntax for defining schema modules.