AshOaskit.SpecBuilder.Default (AshOasKit v0.2.0)

View Source

Default AshOaskit.SpecBuilder implementation.

This module is the out-of-the-box spec builder used by AshOaskit.Router when no custom :spec_builder option is provided. It delegates directly to AshOaskit.spec/1 and applies no post-processing, making it the zero-configuration path for serving OpenAPI specifications.

Behaviour Contract

Implements the single callback defined by AshOaskit.SpecBuilder:

@callback spec(openapi_version :: String.t(), opts :: map()) :: map()

The opts map is forwarded from the Router macro and may contain:

KeyTypeDefaultDescription
:domains[module()][]Ash domains to introspect
:titleString.t()"API"Value for info.title
:versionString.t()"1.0.0"Value for info.version
:descriptionString.t()nilValue for info.description
:servers[map()][]Server objects for servers array

When to Replace

Switch to a custom SpecBuilder when you need to:

  • Inject security schemes (bearerAuth, OAuth2, API keys)
  • Add vendor extensions (x-* fields)
  • Filter or rewrite paths based on environment or feature flags
  • Merge specs from multiple sources

See AshOaskit.SpecBuilder for the behaviour documentation and examples.