docs/reference/spec-attributes.md
This page is generated automatically from the swagger-php sources.
For improvements head over to GitHub and create a PR ;)
Spec attributes are typed PHP 8.1+ attributes in the OpenApi\Spec namespace — the foundation of the
spec-attributes pipeline (--mode spec or --mode hybrid).
They are immutable data containers with no serialization logic. Relationships between attributes are
declared via contains() (what children an attribute absorbs) and merge() (what parent an attribute
composes into). The Assembler resolves nesting, and Augmenters
enrich the collected specification before compilation.
Typed subclasses (e.g. Operation\Get, Parameter\Path, Flow\AuthorizationCode) pre-fill common
fields to reduce boilerplate — the base class can always be used directly.
Base class for custom attributes.
By default not allowed to contain other attributes, but can be inline nested into any other attribute (including itself).
Container for reusable component definitions.
Place on a class to declare standalone components that go into the components section of the OpenAPI document. The Components attribute itself is not emitted — its children are promoted to their respective Specification buckets.
The primary use case is for DTOs that are NOT roots and therefore cannot be declared at class level on their own: Parameter, Header, Link, and Example. Other types (Schema, PathItem, SecurityScheme, named Response/RequestBody) are already roots and can be declared directly on a class without needing a Components wrapper.
#[Components] class SharedComponents { #[Parameter(parameter: 'tenant_id', name: 'tenant_id', in: 'path', schema: new Schema(type: 'string'))] public string $tenantId;
#[Header(header: 'X-Rate-Limit', schema: new Schema(type: 'integer'))]
public string $rateLimit;
#[Example(example: 'dog', summary: 'A dog', value: ['name' => 'Fido'])]
public string $dogExample;
}
<a href="#schema">Schema</a>, <a href="#parameter">Parameter</a>, <a href="#response">Response</a>, <a href="#requestbody">RequestBody</a>, <a href="#header">Header</a>, <a href="#security-scheme">Security\Scheme</a>, <a href="#link">Link</a>, <a href="#example">Example</a>, <a href="#pathitem">PathItem</a>
Contact information for the exposed API.
<a href="#info">Info</a>
string|null
The identifying name of the contact person/organizationstring|null
A URL pointing to the contact informationstring|null
The email address of the contact person/organizationAids in serialization, deserialization, and validation when request bodies or responses can be one of several schemas (used with oneOf, anyOf, allOf).
<a href="#schema">Schema</a>
string|null
The name of the property in the payload that distinguishes typesarray<string,string>|null
Maps payload values to schema names or referencesDescribes the encoding for a single property in a media type.
<a href="#mediatype">MediaType</a>, <a href="#mediatype-json">MediaType\Json</a>, <a href="#mediatype-xml">MediaType\Xml</a>
string|null
The property name this encoding applies tostring|null
The Content-Type for encoding a specific propertylist<Header>|null
Additional headers for multipart media typesstring|ParameterStyle|null
How the property value is serializedbool|null
Whether arrays/objects generate separate parametersbool|null
Whether reserved characters are allowed without encodingDescribes an example value for a parameter, media type, or schema.
<a href="#components">Components</a>, <a href="#header">Header</a>, <a href="#mediatype">MediaType</a>, <a href="#mediatype-json">MediaType\Json</a>, <a href="#mediatype-xml">MediaType\Xml</a>, <a href="#parameter">Parameter</a>, <a href="#parameter-cookie">Parameter\Cookie</a>, <a href="#parameter-header">Parameter\Header</a>, <a href="#parameter-path">Parameter\Path</a>, <a href="#parameter-query">Parameter\Query</a>
string|null
Reusable example identifier (component key)string|null
Short description of the examplestring|null
Long description of the example (CommonMark syntax)mixed
Embedded literal example valuestring|null
A URI pointing to the literal examplestring|null
A JSON Reference to a reusable exampleAllows referencing an external resource for extended documentation.
<a href="#tag">Tag</a>
string|null
The URL for the target documentationstring|null
A description of the target documentation (CommonMark syntax)Configuration details for a supported OAuth2 flow.
Typed subtypes pre-fill the flow type:
OA\Flow\Implicit - implicit grant (authorizationUrl required)
OA\Flow\Password - resource owner password credentials (tokenUrl required)
OA\Flow\ClientCredentials - client credentials grant (tokenUrl required)
OA\Flow\AuthorizationCode - authorization code grant (authorizationUrl + tokenUrl required)
#[OA\Security\Scheme\OAuth2(securityScheme: 'oauth2', flows: [ new OA\Flow\AuthorizationCode( authorizationUrl: 'https://example.com/oauth/authorize', tokenUrl: 'https://example.com/oauth/token', scopes: ['read:pets' => 'Read pets', 'write:pets' => 'Write pets'], ), ])]
Produces: components: securitySchemes: oauth2: type: oauth2 flows: authorizationCode: authorizationUrl: https://example.com/oauth/authorize tokenUrl: https://example.com/oauth/token scopes: read:pets: Read pets write:pets: Write pets
<a href="#security-scheme">Security\Scheme</a>, <a href="#security-scheme-apikey">Security\Scheme\ApiKey</a>, <a href="#security-scheme-http">Security\Scheme\Http</a>, <a href="#security-scheme-mutualtls">Security\Scheme\MutualTls</a>, <a href="#security-scheme-oauth2">Security\Scheme\OAuth2</a>, <a href="#security-scheme-openidconnect">Security\Scheme\OpenIdConnect</a>
string|FlowType|null
The OAuth2 flow type (implicit, password, clientCredentials, authorizationCode)string|null
The authorization URL for this flowstring|null
The token URL for this flowstring|null
The URL for obtaining refresh tokensarray<string,string>|null
The available scopes for the OAuth2 security schemeConfiguration for the OAuth2 Authorization Code flow.
<a href="#security-scheme">Security\Scheme</a>
string|null
No details available.string|null
No details available.string|null
No details available.array<string,string>|null
No details available.Configuration for the OAuth2 Client Credentials flow.
<a href="#security-scheme">Security\Scheme</a>
string|null
No details available.string|null
No details available.array<string,string>|null
No details available.Configuration for the OAuth2 Implicit flow.
<a href="#security-scheme">Security\Scheme</a>
string|null
No details available.string|null
No details available.array<string,string>|null
No details available.Configuration for the OAuth2 Resource Owner Password flow.
<a href="#security-scheme">Security\Scheme</a>
string|null
No details available.string|null
No details available.array<string,string>|null
No details available.Describes a single HTTP header.
<a href="#components">Components</a>, <a href="#response">Response</a>
<a href="#mediatype">MediaType</a>, <a href="#example">Example</a>
string|null
The header name (component key)string|null
A brief description of the header (CommonMark syntax)bool|null
Whether the header is mandatorybool|null
Whether the header is deprecatedstring|null
A JSON Reference to a reusable headerstring|ParameterStyle|null
How the header value is serializedbool|null
Whether arrays/objects generate separate parametersSchema|null
The schema defining the type for the headermixed
Example of the header's valuelist<Example>|null
Examples of the header's valueMediaType|list<MediaType>|null
Content-type based header serializationMetadata about the API.
<a href="#contact">Contact</a>, <a href="#license">License</a>
string|null
The title of the APIstring|null
A description of the API (CommonMark syntax)string|null
A URL to the Terms of Service for the APIstring|null
The version of the API documentContact|null
Contact information for the APILicense|null
License information for the APIstring|null
A short summary of the APILicense information for the exposed API.
<a href="#info">Info</a>
string|null
The license name used for the APIstring|null
An SPDX license expression for the APIstring|null
A URL to the license used for the APIDescribes a possible design-time link for a response.
<a href="#components">Components</a>, <a href="#response">Response</a>
string|null
Reusable link identifier (component key)string|null
A relative or absolute URI reference to a linked operationstring|null
The name of an existing operation (mutually exclusive with operationRef)array<string,mixed>|null
Values to pass to the linked operation's parametersmixed
A value to use as the request body for the linked operationstring|null
A description of the link (CommonMark syntax)string|null
A JSON Reference to a reusable linkServer|null
A server object to be used by the target operationDescribes the content payload for a specific media type.
<a href="#header">Header</a>, <a href="#parameter">Parameter</a>, <a href="#parameter-cookie">Parameter\Cookie</a>, <a href="#parameter-header">Parameter\Header</a>, <a href="#parameter-path">Parameter\Path</a>, <a href="#parameter-query">Parameter\Query</a>, <a href="#requestbody">RequestBody</a>, <a href="#response">Response</a>
<a href="#encoding">Encoding</a>, <a href="#example">Example</a>
string|null
The media type identifier (e.g. 'application/json')Schema|null
The schema defining the contentmixed
Example of the media type contentlist<Example>|null
Examples of the media type contentlist<Encoding>|array<string,Encoding>|null
Encoding information for specific propertiesDescribes the content payload for application/json.
A shortcut version of OA\MediaType with some of the more common OA\Schema properties added.
mediaType is set to application/json by default.ref, type, items, properties and required may be used and will be expanded into a nested OA\Schema automatically.schema is explicitly set, the custom OA\Schema properties will be ignored.Allows to shorten this:
#[OA\Response(response: 200, content: [ new OA\MediaType(mediaType: 'application/json', schema: new OA\Schema(type: 'array', items: new OA\Schema(ref: Pet::class))), ])]
to this:
#[OA\Response(response: 200, content: [new OA\MediaType\Json(type: 'array', items: new OA\Schema(ref: Pet::class))])]
The Shortcuts augmenter expands the schema properties into a nested OA\Schema automatically.
<a href="#response">Response</a>, <a href="#requestbody">RequestBody</a>, <a href="#parameter">Parameter</a>
<a href="#encoding">Encoding</a>, <a href="#example">Example</a>
string|null
A JSON Reference to a reusable schemastring|list<string>|null
The value type(s) (string, number, integer, boolean, array, object, null)Schema|string|null
Schema for array itemslist<Property|Schema>|null
Object property definitionslist<string>|null
List of required property namesSchema|null
The schema defining the contentmixed
Example of the media type contentlist<OA\Example>|null
Examples of the media type contentlist<OA\Encoding>|array<string,OA\Encoding>|null
Encoding information for specific propertiesDescribes the content payload for application/xml.
A shortcut version of OA\MediaType with some of the more common OA\Schema properties added.
mediaType is set to application/xml by default.ref, type, items, properties and required may be used and will be expanded into a nested OA\Schema automatically.schema is explicitly set, the custom OA\Schema properties will be ignored.Allows to shorten this:
#[OA\Response(response: 200, content: [ new OA\MediaType(mediaType: 'application/xml', schema: new OA\Schema(type: 'array', items: new OA\Schema(ref: Pet::class))), ])]
to this:
#[OA\Response(response: 200, content: [new OA\MediaType\Xml(type: 'array', items: new OA\Schema(ref: Pet::class))])]
The Shortcuts augmenter expands the schema properties into a nested OA\Schema automatically.
<a href="#response">Response</a>, <a href="#requestbody">RequestBody</a>, <a href="#parameter">Parameter</a>
<a href="#encoding">Encoding</a>, <a href="#example">Example</a>
string|null
A JSON Reference to a reusable schemastring|list<string>|null
The value type(s) (string, number, integer, boolean, array, object, null)Schema|string|null
Schema for array itemslist<Property|Schema>|null
Object property definitionslist<string>|null
List of required property namesSchema|null
The schema defining the contentmixed
Example of the media type contentlist<OA\Example>|null
Examples of the media type contentlist<OA\Encoding>|array<string,OA\Encoding>|null
Encoding information for specific propertiesThe root element of an OpenAPI definition.
<a href="#security-requirement">Security\Requirement</a>
string|null
The OpenAPI specification version (e.g. '3.1.0')list<Security\Requirement>|null
Default security requirements for the APIDescribes a single API operation on a path.
Typed subclasses pre-fill the HTTP method — use them instead of specifying method manually:
#[OA\Operation\Get(path: '/pets/{id}', responses: [ new OA\Response(response: 200, description: 'A pet', content: [ new OA\MediaType(schema: new OA\Schema(ref: Pet::class)), ]), ])] public function show(int $id) {}
Produces: paths: /pets/{id}: get: operationId: show responses: '200': description: A pet content: application/json: schema: $ref: '#/components/schemas/Pet'
For webhooks, use webhook instead of path:
#[OA\Operation\Post(webhook: 'petAdopted', responses: [...])]
<a href="#parameter">Parameter</a>, <a href="#response">Response</a>, <a href="#requestbody">RequestBody</a>, <a href="#server">Server</a>, <a href="#security-requirement">Security\Requirement</a>
string|null
The URL path for the operationstring|null
The webhook name (mutually exclusive with path)string|HttpMethod|null
The HTTP method (get, post, put, delete, etc.)string|null
Unique identifier for the operationstring|null
A short summary of what the operation doesstring|null
A verbose explanation of the operation (CommonMark syntax)list<string>|null
Tags for API documentation groupinglist<Parameter>|null
Parameters applicable to this operationRequestBody|null
The request body applicable to this operationlist<Response>|null
The list of possible responsesarray<string,mixed>|null
Possible out-of-band callbacks related to the operationbool|null
Whether the operation is deprecatedlist<Security\Requirement>|null
Security mechanisms that can be used for this operationlist<Server>|null
Alternative servers for this operationExternalDocumentation|null
Additional external documentationShorthand for an HTTP DELETE operation.
<a href="#parameter">Parameter</a>, <a href="#response">Response</a>, <a href="#requestbody">RequestBody</a>, <a href="#server">Server</a>, <a href="#security-requirement">Security\Requirement</a>
string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.list<string>|null
No details available.list<OA\Parameter>|null
No details available.OpenApi\Spec\RequestBody|null
No details available.list<OA\Response>|null
No details available.array<string,mixed>|null
No details available.bool|null
No details available.list<OA\Security\Requirement>|null
No details available.list<OA\Server>|null
No details available.OpenApi\Spec\ExternalDocumentation|null
No details available.Shorthand for an HTTP GET operation.
<a href="#parameter">Parameter</a>, <a href="#response">Response</a>, <a href="#requestbody">RequestBody</a>, <a href="#server">Server</a>, <a href="#security-requirement">Security\Requirement</a>
string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.list<string>|null
No details available.list<OA\Parameter>|null
No details available.OpenApi\Spec\RequestBody|null
No details available.list<OA\Response>|null
No details available.array<string,mixed>|null
No details available.bool|null
No details available.list<OA\Security\Requirement>|null
No details available.list<OA\Server>|null
No details available.OpenApi\Spec\ExternalDocumentation|null
No details available.Shorthand for an HTTP HEAD operation.
<a href="#parameter">Parameter</a>, <a href="#response">Response</a>, <a href="#requestbody">RequestBody</a>, <a href="#server">Server</a>, <a href="#security-requirement">Security\Requirement</a>
string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.list<string>|null
No details available.list<OA\Parameter>|null
No details available.OpenApi\Spec\RequestBody|null
No details available.list<OA\Response>|null
No details available.array<string,mixed>|null
No details available.bool|null
No details available.list<OA\Security\Requirement>|null
No details available.list<OA\Server>|null
No details available.OpenApi\Spec\ExternalDocumentation|null
No details available.Shorthand for an HTTP OPTIONS operation.
<a href="#parameter">Parameter</a>, <a href="#response">Response</a>, <a href="#requestbody">RequestBody</a>, <a href="#server">Server</a>, <a href="#security-requirement">Security\Requirement</a>
string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.list<string>|null
No details available.list<OA\Parameter>|null
No details available.OpenApi\Spec\RequestBody|null
No details available.list<OA\Response>|null
No details available.array<string,mixed>|null
No details available.bool|null
No details available.list<OA\Security\Requirement>|null
No details available.list<OA\Server>|null
No details available.OpenApi\Spec\ExternalDocumentation|null
No details available.Shorthand for an HTTP PATCH operation.
<a href="#parameter">Parameter</a>, <a href="#response">Response</a>, <a href="#requestbody">RequestBody</a>, <a href="#server">Server</a>, <a href="#security-requirement">Security\Requirement</a>
string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.list<string>|null
No details available.list<OA\Parameter>|null
No details available.OpenApi\Spec\RequestBody|null
No details available.list<OA\Response>|null
No details available.array<string,mixed>|null
No details available.bool|null
No details available.list<OA\Security\Requirement>|null
No details available.list<OA\Server>|null
No details available.OpenApi\Spec\ExternalDocumentation|null
No details available.Shorthand for an HTTP POST operation.
<a href="#parameter">Parameter</a>, <a href="#response">Response</a>, <a href="#requestbody">RequestBody</a>, <a href="#server">Server</a>, <a href="#security-requirement">Security\Requirement</a>
string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.list<string>|null
No details available.list<OA\Parameter>|null
No details available.OpenApi\Spec\RequestBody|null
No details available.list<OA\Response>|null
No details available.array<string,mixed>|null
No details available.bool|null
No details available.list<OA\Security\Requirement>|null
No details available.list<OA\Server>|null
No details available.OpenApi\Spec\ExternalDocumentation|null
No details available.Shorthand for an HTTP PUT operation.
<a href="#parameter">Parameter</a>, <a href="#response">Response</a>, <a href="#requestbody">RequestBody</a>, <a href="#server">Server</a>, <a href="#security-requirement">Security\Requirement</a>
string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.list<string>|null
No details available.list<OA\Parameter>|null
No details available.OpenApi\Spec\RequestBody|null
No details available.list<OA\Response>|null
No details available.array<string,mixed>|null
No details available.bool|null
No details available.list<OA\Security\Requirement>|null
No details available.list<OA\Server>|null
No details available.OpenApi\Spec\ExternalDocumentation|null
No details available.Shorthand for an HTTP TRACE operation.
<a href="#parameter">Parameter</a>, <a href="#response">Response</a>, <a href="#requestbody">RequestBody</a>, <a href="#server">Server</a>, <a href="#security-requirement">Security\Requirement</a>
string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.list<string>|null
No details available.list<OA\Parameter>|null
No details available.OpenApi\Spec\RequestBody|null
No details available.list<OA\Response>|null
No details available.array<string,mixed>|null
No details available.bool|null
No details available.list<OA\Security\Requirement>|null
No details available.list<OA\Server>|null
No details available.OpenApi\Spec\ExternalDocumentation|null
No details available.Describes a single operation parameter.
Typed subtypes pre-fill in (and required for path):
OA\Parameter\Path - path parameters (in: path, required: true)OA\Parameter\Query - query string parameters (in: query)OA\Parameter\Header - header parameters (in: header)OA\Parameter\Cookie - cookie parameters (in: cookie)Inline on an operation:
#[OA\Operation\Get(path: '/pets', parameters: [ new OA\Parameter\Query(name: 'status', schema: new OA\Schema(type: 'string', enum: ['active', 'sold'])), ])]
Or as a reusable component (set parameter for the component key):
#[OA\Parameter\Path(parameter: 'petId', name: 'id', schema: new OA\Schema(type: 'integer'))]
Produces: components: parameters: petId: name: id in: path required: true schema: type: integer
<a href="#components">Components</a>, <a href="#operation">Operation</a>, <a href="#operation-delete">Operation\Delete</a>, <a href="#operation-get">Operation\Get</a>, <a href="#operation-head">Operation\Head</a>, <a href="#operation-options">Operation\Options</a>, <a href="#operation-patch">Operation\Patch</a>, <a href="#operation-post">Operation\Post</a>, <a href="#operation-put">Operation\Put</a>, <a href="#operation-trace">Operation\Trace</a>, <a href="#pathitem">PathItem</a>
<a href="#mediatype">MediaType</a>, <a href="#example">Example</a>
string|null
Reusable parameter identifier (component key)string|null
The name of the parameterstring|ParameterIn|null
The location of the parameter (query, header, path, cookie)string|null
A brief description of the parameter (CommonMark syntax)bool|null
Whether the parameter is mandatorybool|null
Whether the parameter is deprecatedbool|null
Whether empty-valued parameters are allowedstring|null
A JSON Reference to a reusable parameterstring|ParameterStyle|null
How the parameter value is serializedbool|null
Whether arrays/objects generate separate parametersbool|null
Whether reserved characters are allowed without encodingSchema|null
The schema defining the type for the parametermixed
Example of the parameter's valuelist<Example>|null
Examples of the parameter's valueMediaType|list<MediaType>|null
Content-type based parameter serializationA parameter passed via an HTTP cookie.
<a href="#operation">Operation</a>, <a href="#pathitem">PathItem</a>
<a href="#mediatype">MediaType</a>, <a href="#example">Example</a>
string|null
No details available.string|null
No details available.string|null
No details available.bool|null
No details available.bool|null
No details available.string|null
No details available.bool|null
No details available.OpenApi\Spec\Schema|null
No details available.mixed|null
No details available.list<OA\Example>|null
No details available.OA\MediaType|list<OA\MediaType>|null
No details available.A parameter passed via an HTTP header.
<a href="#operation">Operation</a>, <a href="#pathitem">PathItem</a>
<a href="#mediatype">MediaType</a>, <a href="#example">Example</a>
string|null
No details available.string|null
No details available.string|null
No details available.bool|null
No details available.bool|null
No details available.string|null
No details available.bool|null
No details available.OpenApi\Spec\Schema|null
No details available.mixed|null
No details available.list<OA\Example>|null
No details available.OA\MediaType|list<OA\MediaType>|null
No details available.A parameter passed via the URL path (always required).
<a href="#operation">Operation</a>, <a href="#pathitem">PathItem</a>
<a href="#mediatype">MediaType</a>, <a href="#example">Example</a>
string|null
No details available.string|null
No details available.string|null
No details available.bool|null
No details available.string|null
No details available.OpenApi\Spec\ParameterStyle|string|null
No details available.bool|null
No details available.OpenApi\Spec\Schema|null
No details available.mixed|null
No details available.list<OA\Example>|null
No details available.OA\MediaType|list<OA\MediaType>|null
No details available.A parameter passed via the URL query string.
<a href="#operation">Operation</a>, <a href="#pathitem">PathItem</a>
<a href="#mediatype">MediaType</a>, <a href="#example">Example</a>
string|null
No details available.string|null
No details available.string|null
No details available.bool|null
No details available.bool|null
No details available.bool|null
No details available.string|null
No details available.OpenApi\Spec\ParameterStyle|string|null
No details available.bool|null
No details available.bool|null
No details available.OpenApi\Spec\Schema|null
No details available.mixed|null
No details available.list<OA\Example>|null
No details available.OA\MediaType|list<OA\MediaType>|null
No details available.Describes shared metadata for all operations under a path.
Place on a controller class — the path is inferred from its operations. Parameters, summary, description and servers are emitted at path level in the OpenAPI output. Prefix, tags, security and responses are controller-level features that compose via class hierarchy and apply to all contained operations.
Shared path-level properties (parameters, summary, description, servers per OpenAPI spec):
#[PathItem(parameters: [new Parameter\Path(name: 'id', schema: new Schema(type: 'integer'))])] class ProductController { #[Operation\Get(path: '/products/{id}')] public function get() {} }
The path in the output is inferred from the operations — no need to declare it on PathItem, avoiding duplication.
Prefix composition with inherited metadata:
#[PathItem(prefix: '/api/v1')] class BaseController {}
#[PathItem(prefix: '/users', tags: ['Users'], security: [new Security\Requirement(scheme: 'bearerAuth')])] #[Response(response: 401, description: 'Unauthorized')] #[Response(response: 500, description: 'Server error')] class UserController extends BaseController { #[Operation\Get(path: '/list')] // resolved: /api/v1/users/list, tags: ['Users'] public function list() {}
#[Operation\Get(path: '/{id}')] // resolved: /api/v1/users/{id}, tags: ['Users']
public function get() {}
}
Prefixes compose by walking the class hierarchy — each ancestor PathItem contributes its prefix segment. All collection properties merge additively: tags, security, responses, and parameters accumulate from the full ancestor chain. Deduplication is by value (tags), by scheme (security), by status code (responses), and by name+in (parameters).
<a href="#components">Components</a>
<a href="#parameter">Parameter</a>, <a href="#server">Server</a>, <a href="#response">Response</a>, <a href="#security-requirement">Security\Requirement</a>
string|null
A JSON Reference to a reusable path itemstring|null
Path prefix — composable via class hierarchystring|null
An optional summary, intended to apply to all operations in this pathstring|null
An optional description, intended to apply to all operations in this pathlist<Parameter>|null
Parameters applicable to all operations under this pathlist<Server>|null
Alternative servers for all operations under this pathlist<string>|null
Tags to clone to contained operationslist<Security\Requirement>|null
Security requirements to clone to contained operationslist<Response>|null
Shared responses to clone to contained operationsDefines a single property within a Schema object.
<a href="#schema">Schema</a>, <a href="#schema-items">Schema\Items</a>
string|null
The property nameSchema|null
The schema defining the property type and constraintsDescribes a single request body.
<a href="#components">Components</a>, <a href="#operation">Operation</a>, <a href="#operation-delete">Operation\Delete</a>, <a href="#operation-get">Operation\Get</a>, <a href="#operation-head">Operation\Head</a>, <a href="#operation-options">Operation\Options</a>, <a href="#operation-patch">Operation\Patch</a>, <a href="#operation-post">Operation\Post</a>, <a href="#operation-put">Operation\Put</a>, <a href="#operation-trace">Operation\Trace</a>
<a href="#mediatype">MediaType</a>
string|null
Reusable request body identifier (component key)string|null
A brief description of the request body (CommonMark syntax)bool|null
Whether the request body is requiredstring|null
A JSON Reference to a reusable request bodyMediaType|list<MediaType>|null
The content of the request bodyDescribes a single response from an API operation.
<a href="#components">Components</a>, <a href="#operation">Operation</a>, <a href="#operation-delete">Operation\Delete</a>, <a href="#operation-get">Operation\Get</a>, <a href="#operation-head">Operation\Head</a>, <a href="#operation-options">Operation\Options</a>, <a href="#operation-patch">Operation\Patch</a>, <a href="#operation-post">Operation\Post</a>, <a href="#operation-put">Operation\Put</a>, <a href="#operation-trace">Operation\Trace</a>, <a href="#pathitem">PathItem</a>
<a href="#header">Header</a>, <a href="#mediatype">MediaType</a>, <a href="#link">Link</a>
string|int|null
The HTTP status code or 'default'string|null
A description of the response (CommonMark syntax)string|null
A JSON Reference to a reusable responselist<Header>|null
Headers sent with the responseMediaType|list<MediaType>|null
Possible response payloadslist<Link>|null
Design-time links for the responseDefines the structure and validation rules for a data type.
On a class — becomes a reusable component schema (name inferred from class):
#[OA\Schema] class Pet { #[OA\Property] public string $name; #[OA\Property] public ?int $age; }
Produces: components: schemas: Pet: type: object properties: name: { type: string } age: { type: integer, nullable: true }
Inline — used within parameters, responses, or other schemas:
new OA\Schema(type: 'array', items: new OA\Schema(ref: Pet::class))
<a href="#components">Components</a>, <a href="#schema">Schema</a>, <a href="#schema-items">Schema\Items</a>
<a href="#property">Property</a>, <a href="#schema">Schema</a>
string|null
Reusable schema identifier (component key)string|null
A title for the schemastring|null
A description of the schema (CommonMark syntax)string|null
A JSON Reference to a reusable schemastring|list<string>|null
The value type(s) (string, number, integer, boolean, array, object, null)string|null
Further refines the type (e.g. int32, int64, float, double, date-time, email)bool|null
Whether the value can be null (OAS 3.0 only; use type array in 3.1+)int|null
Minimum string lengthint|null
Maximum string lengthstring|null
Regular expression pattern the string must matchstring|null
The media type of string content encodingstring|null
The encoding used for string content (e.g. base64)int|float|null
Minimum numeric value (inclusive)int|float|null
Maximum numeric value (inclusive)int|float|bool|null
Exclusive minimum valueint|float|bool|null
Exclusive maximum valueint|float|null
The value must be a multiple of this numberSchema|string|null
Schema for array itemsint|null
Minimum number of array itemsint|null
Maximum number of array itemsbool|null
Whether array items must be uniquelist<Schema>|null
Schemas for positional array items (tuple validation)Schema|bool|null
Schema that at least one array item must matchint|null
Minimum number of items matching containsint|null
Maximum number of items matching containsSchema|bool|null
Schema for items not covered by other keywordslist<Property|Schema>|null
Object property definitionslist<string>|null
List of required property namesSchema|bool|null
Schema or boolean for additional propertiesarray<string,Schema>|null
Schemas for properties matching regex patternsint|null
Minimum number of propertiesint|null
Maximum number of propertiesSchema|bool|null
Schema for properties not covered by other keywordsSchema|null
Schema that property names must validate againstarray<string,list<string>>|null
Property-level required dependenciesarray<string,Schema>|null
Property-level schema dependencieslist<Schema>|null
All schemas must match (AND composition)list<Schema>|null
At least one schema must match (OR composition)list<Schema>|null
Exactly one schema must match (XOR composition)Schema|null
The schema must NOT matchSchema|null
Conditional schema (if-then-else)Schema|null
Applied when 'if' succeedsSchema|null
Applied when 'if' failslist<string|int|float|bool|\UnitEnum|class-string<\UnitEnum>|null>|null
Allowed valuesmixed
A single allowed valuemixed
An example valuelist<mixed>|null
A list of example valuesbool|null
Whether the schema is deprecatedbool|null
Whether the value is read-onlybool|null
Whether the value is write-onlymixed
The default valueDiscriminator|null
Discriminator for polymorphismExternalDocumentation|null
Additional external documentationXml|null
XML representation metadataShortcut for OA\Schema with type array and items.
Allows to shorten this:
#[OA\Schema] class Pet { #[OA\Property] #[OA\Schema(type: 'array', items: new OA\Schema(ref: MyModel::class))] public array $names; }
to this:
#[OA\Schema] class Pet { #[OA\Property] #[OA\Schema\Items(ref: MyModel::class)] public array $names; }
The Shortcuts augmenter wraps this into OA\Schema(type: 'array', items: ...) automatically.
<a href="#property">Property</a>, <a href="#parameter">Parameter</a>, <a href="#header">Header</a>, <a href="#mediatype">MediaType</a>
<a href="#property">Property</a>, <a href="#schema">Schema</a>
string|null
Reusable schema identifier (component key)string|null
A title for the schemastring|null
A description of the schema (CommonMark syntax)string|null
A JSON Reference to a reusable schemastring|list<string>|null
The value type(s) (string, number, integer, boolean, array, object, null)string|null
Further refines the type (e.g. int32, int64, float, double, date-time, email)bool|null
Whether the value can be null (OAS 3.0 only; use type array in 3.1+)int|null
Minimum string lengthint|null
Maximum string lengthstring|null
Regular expression pattern the string must matchstring|null
The media type of string content encodingstring|null
The encoding used for string content (e.g. base64)int|float|null
Minimum numeric value (inclusive)int|float|null
Maximum numeric value (inclusive)int|float|bool|null
Exclusive minimum valueint|float|bool|null
Exclusive maximum valueint|float|null
The value must be a multiple of this numberSchema|string|null
Schema for array itemsint|null
Minimum number of array itemsint|null
Maximum number of array itemsbool|null
Whether array items must be uniquelist<Schema>|null
Schemas for positional array items (tuple validation)Schema|bool|null
Schema that at least one array item must matchint|null
Minimum number of items matching containsint|null
Maximum number of items matching containsSchema|bool|null
Schema for items not covered by other keywordslist<Property|Schema>|null
Object property definitionslist<string>|null
List of required property namesSchema|bool|null
Schema or boolean for additional propertiesarray<string,Schema>|null
Schemas for properties matching regex patternsint|null
Minimum number of propertiesint|null
Maximum number of propertiesSchema|bool|null
Schema for properties not covered by other keywordsSchema|null
Schema that property names must validate againstarray<string,list<string>>|null
Property-level required dependenciesarray<string,Schema>|null
Property-level schema dependencieslist<Schema>|null
All schemas must match (AND composition)list<Schema>|null
At least one schema must match (OR composition)list<Schema>|null
Exactly one schema must match (XOR composition)Schema|null
The schema must NOT matchSchema|null
Conditional schema (if-then-else)Schema|null
Applied when 'if' succeedsSchema|null
Applied when 'if' failslist<string|int|float|bool|\UnitEnum|class-string<\UnitEnum>|null>|null
Allowed valuesmixed
A single allowed valuemixed
An example valuelist<mixed>|null
A list of example valuesbool|null
Whether the schema is deprecatedbool|null
Whether the value is read-onlybool|null
Whether the value is write-onlymixed
The default valueDiscriminator|null
Discriminator for polymorphismExternalDocumentation|null
Additional external documentationXml|null
XML representation metadataA security requirement declaring which security schemes apply.
Each requirement instance represents one entry in the security array (OR logic). Multiple schemes within a single requirement represent AND logic.
<a href="#openapi">OpenApi</a>, <a href="#operation">Operation</a>, <a href="#operation-delete">Operation\Delete</a>, <a href="#operation-get">Operation\Get</a>, <a href="#operation-head">Operation\Head</a>, <a href="#operation-options">Operation\Options</a>, <a href="#operation-patch">Operation\Patch</a>, <a href="#operation-post">Operation\Post</a>, <a href="#operation-put">Operation\Put</a>, <a href="#operation-trace">Operation\Trace</a>, <a href="#pathitem">PathItem</a>
string|null
Single scheme name (shorthand for simple requirements)list<string>|null
Scopes for the single scheme (OAuth2/OpenIdConnect)array<string,list<string>>|null
Map of scheme names to scopes (for AND logic with multiple schemes)Defines a security scheme that can be used by the operations.
Typed subtypes are available for each security scheme type:
OA\Security\Scheme\Http - HTTP authentication (Basic, Bearer, etc.)OA\Security\Scheme\ApiKey - API key in header, query, or cookieOA\Security\Scheme\OAuth2 - OAuth2 with one or more flowsOA\Security\Scheme\OpenIdConnect - OpenID Connect discoveryOA\Security\Scheme\MutualTls - Mutual TLS authentication<a href="#components">Components</a>
<a href="#flow">Flow</a>
string|null
Reusable security scheme identifier (component key)string|OA\SchemeType|null
The type of the security scheme (apiKey, http, mutualTLS, oauth2, openIdConnect)string|null
A description of the security scheme (CommonMark syntax)string|null
The name of the header, query, or cookie parameter (apiKey)string|OA\SchemeIn|null
The location of the API key (query, header, cookie)string|null
The HTTP authorization scheme (http)string|null
A hint about the format of the bearer token (http/bearer)string|null
The OpenID Connect URL to discover configuration (openIdConnect)list<OA\Flow>|null
The available OAuth2 flows (oauth2)string|null
A JSON Reference to a reusable security schemeAn API key security scheme (header, query, or cookie).
<a href="#flow">Flow</a>
string|null
No details available.string|null
No details available.string|null
No details available.OpenApi\Spec\SchemeIn|string|null
No details available.An HTTP authentication security scheme (Basic, Bearer, etc.).
<a href="#flow">Flow</a>
string|null
No details available.string|null
No details available.string|null
No details available.string|null
No details available.A Mutual TLS security scheme.
<a href="#flow">Flow</a>
string|null
No details available.string|null
No details available.An OAuth2 security scheme with one or more flows.
<a href="#flow">Flow</a>
string|null
No details available.string|null
No details available.list<OA\Flow>|null
No details available.An OpenID Connect Discovery security scheme.
<a href="#flow">Flow</a>
string|null
No details available.string|null
No details available.string|null
No details available.Represents a Server.
<a href="#operation">Operation</a>, <a href="#operation-delete">Operation\Delete</a>, <a href="#operation-get">Operation\Get</a>, <a href="#operation-head">Operation\Head</a>, <a href="#operation-options">Operation\Options</a>, <a href="#operation-patch">Operation\Patch</a>, <a href="#operation-post">Operation\Post</a>, <a href="#operation-put">Operation\Put</a>, <a href="#operation-trace">Operation\Trace</a>, <a href="#pathitem">PathItem</a>
<a href="#servervariable">ServerVariable</a>
string|null
A URL to the target hoststring|null
A description of the host (CommonMark syntax)list<ServerVariable>|null
Variables for server URL template substitutionRepresents a Server Variable for server URL template substitution.
<a href="#server">Server</a>
string|null
The variable namestring|null
The default value to use for substitutionstring|null
A description of the server variable (CommonMark syntax)list<string>|null
Enumeration of allowed string values for substitutionAdds metadata to a single tag used by the Operation Object.
<a href="#externaldocumentation">ExternalDocumentation</a>
string|null
The name of the tagstring|null
A description of the tag (CommonMark syntax)ExternalDocumentation|null
Additional external documentation for this tagMetadata for XML representation of a schema property.
<a href="#schema">Schema</a>
string|null
Replaces the name of the element/attributestring|null
The URI of the XML namespacestring|null
The namespace prefix to usebool|null
Whether the property translates to an XML attributebool|null
Whether array items are wrapped in an additional element