Basic Phoenix integration helpers for OpenAPI support.
This module provides macros that help integrate OpenAPI definition tracking into Phoenix routers and applications.
It enables routers to declare OpenAPI files and participate in automatic discovery and aggregation of API definitions across the system.
Summary
Functions
Injects OpenAPI router functionality into a module.
Register an OpenAPI spec and its routes with the application.
Register swagger-ui to a given path.
Functions
Injects OpenAPI router functionality into a module.
When used, the module:
- Registers itself in
:persistent_termas an OpenAPI router on load - Enables accumulation of
@openapi_filesmodule attributes - Exposes
__openapi_files__/0for retrieving declared OpenAPI files - Imports
Openapi.Phoenixhelpers
This allows the module to participate automatically in OpenAPI definition discovery and generation.
Register an OpenAPI spec and its routes with the application.
Options:
handler: Default handler of the routes can be overwritten withx-handlerstrict(Defaulttrue): Validates routes at compile time.server: The server/namespace for this spec. Auto-detected from router module if not provided.prefix: Explicit route prefix applied to all generated OpenAPI paths.
Register swagger-ui to a given path.
Options:
server: The server/namespace whose spec will be served on swagger-ui.prefix: Explicit route prefix applied to the path.