OpenApiOptions
The document-level knobs OpenApiGenerator can’t derive from code: info, servers, and which routes to describe at all.
Everything else in the emitted spec comes from the route table and the actions’ own validator declarations, so this stays deliberately small.
OpenApiOptions::fromConfig() reads the core.openapi.* settings, so an app declares its API metadata once in settings.* and both openapi:generate and any programmatic caller agree on it.
Synopsis
Section titled “Synopsis”final readonly class OpenApiOptions
| Since | 1.2.5 |
| Source | Openapi/OpenApiOptions.php |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
$description | ?``string | readonly. |
$excludeRoutes | array | readonly. |
$modules | array | readonly. |
$problemResponses | bool | readonly. |
$servers | array | readonly. |
$title | string | readonly. |
$useActionDocblocks | bool | readonly. |
$version | string | readonly. |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(string $title = 'API', string $version = '1.0.0', ?string $description = null, list<array{url: string, description?: string}> $servers = [], list<string> $excludeRoutes = [], list<string> $modules = [], bool $problemResponses = true, bool $useActionDocblocks = true): mixed
Use each action class’s docblock as its operation summary/description. Turn off for an app whose action docblocks are internal notes rather than API prose.
| Parameter | Type | Description |
|---|---|---|
$title | string | |
$version | string | |
$description | ?``string | |
$servers | list``<``array{url: string, description?: string}``> | |
$excludeRoutes | list``<``string``> | fnmatch() patterns matched against route names; a matching route is left out. |
$modules | list``<``string``> | Only describe routes belonging to these modules (case-insensitive); empty means all. |
$problemResponses | bool | Emit the RFC 9457 error responses (400 for routes with validators, 500) Quiote’s pipeline actually returns. |
$useActionDocblocks | bool | Use each action class’s docblock as its operation summary/description. Turn off for an app whose action docblocks are internal notes rather than API prose. |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
coversModule(string $module): bool | Whether $module is in scope (always true when no module filter is set). |
excludes(string $routeName): bool | Whether $routeName is excluded by any of the configured fnmatch patterns. |
fromConfig(): OpenApiOptions | Reads the core.openapi.* settings into an options snapshot. |
normalizeServers(array<mixed> $servers): list<array{url: string, description?: string}> | Accepts the two shapes a settings file can plausibly use — a bare list of URLs, or a list of {url, description} maps — and normalizes both to the OpenAPI Server Object shape. |
coversModule()
Section titled “coversModule()”public function coversModule(string $module): bool
Whether $module is in scope (always true when no module filter is set).
| Parameter | Type | Description |
|---|---|---|
$module | string |
Returns bool
excludes()
Section titled “excludes()”public function excludes(string $routeName): bool
Whether $routeName is excluded by any of the configured fnmatch patterns.
| Parameter | Type | Description |
|---|---|---|
$routeName | string |
Returns bool
fromConfig()
Section titled “fromConfig()”public static function fromConfig(): OpenApiOptions
Reads the core.openapi.* settings into an options snapshot.
The title falls back to core.app_name and then to API; an empty description setting becomes null rather than an empty string. servers is normalized to the {url, description?} entries OpenAPI expects, and malformed entries are dropped there.
Returns OpenApiOptions
normalizeServers()
Section titled “normalizeServers()”public static function normalizeServers(array<mixed> $servers): list<array{url: string, description?: string}>
Accepts the two shapes a settings file can plausibly use — a bare list of URLs, or a list of {url, description} maps — and normalizes both to the OpenAPI Server Object shape.
| Parameter | Type | Description |
|---|---|---|
$servers | array``<``mixed``> |
Returns list``<``array{url: string, description?: string}``>