View Source OpenApiSpex.SchemaResolver (open_api_spex v3.21.2)

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

Summary

Functions

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

Functions

Link to this function

resolve_schema_modules(spec)

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