Skip to content

Spec Attribute Reference โ€‹

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 attributes in the OpenApi\Spec namespace โ€” the foundation of the spec-attributes pipeline (--mode spec or --mode hybrid).

They are data containers with no serialization logic; augmenters fill in derived values. Relationships are declared via merge() (what sibling an attribute composes into on the same reflector) and contained() (what parent types can absorb this attribute from inner reflector levels). 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.

Spec Attributes โ€‹

Attachable โ€‹

Base class for custom attributes.

By default not allowed to contain other attributes, but can be inline nested into any other attribute (including itself).

Parameters โ€‹


fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Components โ€‹

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.

Any attribute given a component: key is a root on its own and needs no wrapper. The wrapper remains for the historic spellings โ€” a Header or Example keyed by header/example โ€” and for grouping several components on one class.

On a class it also makes a holder: each member declares a component of its own, and one without a key is named after the member, the way a class names its own. A component declared on a member needs the holder; without it, a keyed one is left out with a warning.

#[Components] class SharedComponents { #[Parameter(component: '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;

}

Nested elements โ€‹


Example, Header, Link, Parameter, Parameter\Cookie, Parameter\Header, Parameter\Path, Parameter\Query, RequestBody, Response, Schema, Schema\AdditionalProperties, Schema\Items, Schema\Ref, Security\Scheme, Security\Scheme\ApiKey, Security\Scheme\Http, Security\Scheme\MutualTls, Security\Scheme\OAuth2, Security\Scheme\OpenIdConnect

Parameters โ€‹


schemas : list<Schema>

No details available.

parameters : list<Parameter>

No details available.

responses : list<Response>

No details available.

requestBodies : list<RequestBody>

No details available.

headers : list<Header>

No details available.

securitySchemes : list<Security\Scheme>

No details available.

links : list<Link>

No details available.

examples : list<Example>

No details available.

pathItems : list<PathItem>

No details available.

mediaTypes : list<MediaType>

OpenAPI 3.2; earlier compilers omit them with a warning

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Contact โ€‹

Contact information for the exposed API.

Allowed in โ€‹


Info

Parameters โ€‹


name : string|null

The identifying name of the contact person/organization

url : string|null

A URL pointing to the contact information

email : string|null

The email address of the contact person/organization

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Discriminator โ€‹

Aids in serialization, deserialization, and validation when request bodies or responses can be one of several schemas (used with oneOf, anyOf, allOf).

Allowed in โ€‹


Schema

Parameters โ€‹


propertyName : string|null

The name of the property in the payload that distinguishes types

mapping : array<string,string>|null

Maps payload values to schema names or references

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Encoding โ€‹

Describes the encoding for a single property in a media type.

Allowed in โ€‹


MediaType

Parameters โ€‹


encoding : string|null

The property name this encoding applies to

contentType : string|null

The Content-Type for encoding a specific property

headers : list<Header>|null

Additional headers for multipart media types

style : string|ParameterStyle|null

How the property value is serialized

explode : bool|null

Whether arrays/objects generate separate parameters

allowReserved : bool|null

Whether reserved characters are allowed without encoding

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Example โ€‹

Describes an example value for a parameter, media type, or schema.

Allowed in โ€‹


Components, MediaType, Parameter, Header

Parameters โ€‹


example : string|null

The example name โ€” the key the example nests under in a media type, parameter or header

summary : string|null

Short description of the example

description : string|null

Long description of the example (CommonMark syntax)

value : mixed

Embedded literal example value

externalValue : string|null

A URI pointing to the literal example

ref : string|null

A JSON Reference to a reusable example

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


ExternalDocumentation โ€‹

Allows referencing an external resource for extended documentation.

Allowed in โ€‹


Tag

Parameters โ€‹


url : string|null

The URL for the target documentation

description : string|null

A description of the target documentation (CommonMark syntax)

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Flow โ€‹

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(component: '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

Allowed in โ€‹


Security\Scheme

Parameters โ€‹


flow : string|FlowType|null

The OAuth2 flow type (implicit, password, clientCredentials, authorizationCode)

authorizationUrl : string|null

The authorization URL for this flow

tokenUrl : string|null

The token URL for this flow

refreshUrl : string|null

The URL for obtaining refresh tokens

scopes : array<string,string>|null

The available scopes for the OAuth2 security scheme

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Flow\AuthorizationCode โ€‹

Configuration for the OAuth2 Authorization Code flow.

Allows to shorten this:

php
new OA\Flow(
    flow: 'authorizationCode',
    authorizationUrl: 'https://example.com/oauth/authorize',
    tokenUrl: 'https://example.com/oauth/token',
    scopes: ['read:pets' => 'Read your pets'],
)

to this:

php
new OA\Flow\AuthorizationCode(
    authorizationUrl: 'https://example.com/oauth/authorize',
    tokenUrl: 'https://example.com/oauth/token',
    scopes: ['read:pets' => 'Read your pets'],
)

Allowed in โ€‹


Security\Scheme

Parameters โ€‹


authorizationUrl : string|null

No details available.

tokenUrl : string|null

No details available.

refreshUrl : string|null

No details available.

scopes : array<string,string>|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Flow\ClientCredentials โ€‹

Configuration for the OAuth2 Client Credentials flow.

Allows to shorten this:

php
new OA\Flow(
    flow: 'clientCredentials',
    tokenUrl: 'https://example.com/oauth/token',
    scopes: ['read:pets' => 'Read your pets'],
)

to this:

php
new OA\Flow\ClientCredentials(
    tokenUrl: 'https://example.com/oauth/token',
    scopes: ['read:pets' => 'Read your pets'],
)

Allowed in โ€‹


Security\Scheme

Parameters โ€‹


tokenUrl : string|null

No details available.

refreshUrl : string|null

No details available.

scopes : array<string,string>|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Flow\Implicit โ€‹

Configuration for the OAuth2 Implicit flow.

Allows to shorten this:

php
new OA\Flow(
    flow: 'implicit',
    authorizationUrl: 'https://example.com/oauth/authorize',
    scopes: ['read:pets' => 'Read your pets'],
)

to this:

php
new OA\Flow\Implicit(
    authorizationUrl: 'https://example.com/oauth/authorize',
    scopes: ['read:pets' => 'Read your pets'],
)

Allowed in โ€‹


Security\Scheme

Parameters โ€‹


authorizationUrl : string|null

No details available.

refreshUrl : string|null

No details available.

scopes : array<string,string>|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Flow\Password โ€‹

Configuration for the OAuth2 Resource Owner Password flow.

Allows to shorten this:

php
new OA\Flow(
    flow: 'password',
    tokenUrl: 'https://example.com/oauth/token',
    scopes: ['read:pets' => 'Read your pets'],
)

to this:

php
new OA\Flow\Password(
    tokenUrl: 'https://example.com/oauth/token',
    scopes: ['read:pets' => 'Read your pets'],
)

Allowed in โ€‹


Security\Scheme

Parameters โ€‹


tokenUrl : string|null

No details available.

refreshUrl : string|null

No details available.

scopes : array<string,string>|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Describes a single HTTP header.

Allowed in โ€‹


Components, Response

Nested elements โ€‹


Example, MediaType, MediaType\Json, MediaType\Xml

Parameters โ€‹


header : string|null

The header name โ€” the key the header nests under in a response or an encoding

description : string|null

A brief description of the header (CommonMark syntax)

required : bool|null

Whether the header is mandatory

deprecated : bool|null

Whether the header is deprecated

ref : string|Schema\Ref|null

A JSON Reference to a reusable header

style : string|ParameterStyle|null

How the header value is serialized

explode : bool|null

Whether arrays/objects generate separate parameters

schema : Schema|null

The schema defining the type for the header

example : mixed

Example of the header's value

examples : list<Example>|null

Examples of the header's value

content : MediaType|list<MediaType>|null

Content-type based header serialization

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Info โ€‹

Metadata about the API.

Nested elements โ€‹


Contact, License

Parameters โ€‹


title : string|null

The title of the API

description : string|null

A description of the API (CommonMark syntax)

termsOfService : string|null

A URL to the Terms of Service for the API

version : string|null

The version of the API document

contact : Contact|null

Contact information for the API

license : License|null

License information for the API

summary : string|null

A short summary of the API

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


License โ€‹

License information for the exposed API.

Allowed in โ€‹


Info

Parameters โ€‹


name : string|null

The license name used for the API

identifier : string|null

An SPDX license expression for the API

url : string|null

A URL to the license used for the API

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Describes a possible design-time link for a response.

Allowed in โ€‹


Components, Response

Parameters โ€‹


link : string|null

The link name โ€” the key the link nests under in a response

operationRef : string|null

A relative or absolute URI reference to a linked operation

operationId : string|null

The name of an existing operation (mutually exclusive with operationRef)

parameters : array<string,mixed>|null

Values to pass to the linked operation's parameters

requestBody : mixed

A value to use as the request body for the linked operation

description : string|null

A description of the link (CommonMark syntax)

ref : string|null

A JSON Reference to a reusable link

server : Server|null

A server object to be used by the target operation

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


MediaType โ€‹

Describes the content payload for a specific media type.

Allowed in โ€‹


Response, RequestBody, Parameter, Header

Nested elements โ€‹


Encoding, Example

Parameters โ€‹


mediaType : string|null

The media type identifier (e.g. 'application/json')

schema : Schema|null

The schema defining the content

example : mixed

Example of the media type content

examples : list<Example>|null

Examples of the media type content

encoding : list<Encoding>|array<string,Encoding>|null

Encoding information for specific properties

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


MediaType\Json โ€‹

Describes 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.
  • If schema is explicitly set, the custom OA\Schema properties will be ignored.

Allows to shorten this:

php
#[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:

php
#[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.

Allowed in โ€‹


Response, RequestBody, Parameter, Header

Parameters โ€‹


ref : string|null

A JSON Reference to a reusable schema

type : TypeInput|null

The value type(s) (string, number, integer, boolean, array, object, null)

items : Schema|string|null

Schema for array items

properties : PropertiesInput|null

Object property definitions, as a list of `Property` or keyed by property name

required : list<string>|null

List of required property names

schema : Schema|null

The schema defining the content

example : mixed

Example of the media type content

examples : list<OA\Example>|null

Examples of the media type content

encoding : list<OA\Encoding>|array<string,OA\Encoding>|null

Encoding information for specific properties

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : OA\Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


MediaType\Xml โ€‹

Describes 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.
  • If schema is explicitly set, the custom OA\Schema properties will be ignored.

Allows to shorten this:

php
#[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:

php
#[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.

Allowed in โ€‹


Response, RequestBody, Parameter, Header

Parameters โ€‹


ref : string|null

A JSON Reference to a reusable schema

type : TypeInput|null

The value type(s) (string, number, integer, boolean, array, object, null)

items : Schema|string|null

Schema for array items

properties : PropertiesInput|null

Object property definitions, as a list of `Property` or keyed by property name

required : list<string>|null

List of required property names

schema : Schema|null

The schema defining the content

example : mixed

Example of the media type content

examples : list<OA\Example>|null

Examples of the media type content

encoding : list<OA\Encoding>|array<string,OA\Encoding>|null

Encoding information for specific properties

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : OA\Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


OpenApi โ€‹

The root element of an OpenAPI definition.

Nested elements โ€‹


Security\Requirement

Parameters โ€‹


version : string|null

The OpenAPI specification version (e.g. '3.1.0')

security : list<Security\Requirement>|null

Default security requirements for the API

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Operation โ€‹

Describes 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: [...])]

Nested elements โ€‹


Parameter, Parameter\Cookie, Parameter\Header, Parameter\Path, Parameter\Query, RequestBody, Response, Security\Requirement, Server

Parameters โ€‹


path : string|null

The URL path for the operation

webhook : string|null

The webhook name (mutually exclusive with path)

method : string|HttpMethod|null

The HTTP method (get, post, put, delete, etc.). An operation still without one at compile time is left out, with a warning

operationId : string|null

Unique identifier for the operation

summary : string|null

A short summary of what the operation does

description : string|null

A verbose explanation of the operation (CommonMark syntax)

tags : list<string>|null

Tags for API documentation grouping

parameters : list<Parameter>|null

Parameters applicable to this operation

requestBody : RequestBody|null

The request body applicable to this operation

responses : list<Response>|null

The list of possible responses

callbacks : array<string,mixed>|null

Possible out-of-band callbacks related to the operation

deprecated : bool|null

Whether the operation is deprecated

security : list<Security\Requirement>|null

Security mechanisms that can be used for this operation

servers : list<Server>|null

Alternative servers for this operation

externalDocs : ExternalDocumentation|null

Additional external documentation

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

methods : list<string|HttpMethod>|null

Several HTTP methods for one declaration, instead of `method`. Split into one operation per method during assembly

Reference โ€‹


Operation\Delete โ€‹

Shorthand for an HTTP DELETE operation.

Allows to shorten this:

php
#[OA\Operation(method: 'delete', path: '/pets/{id}')]

to this:

php
#[OA\Operation\Delete(path: '/pets/{id}')]

Parameters โ€‹


path : string|null

No details available.

webhook : string|null

No details available.

operationId : string|null

No details available.

summary : string|null

No details available.

description : string|null

No details available.

tags : list<string>|null

No details available.

parameters : list<OA\Parameter>|null

No details available.

requestBody : OpenApi\Spec\RequestBody|null

No details available.

responses : list<OA\Response>|null

No details available.

callbacks : array<string,mixed>|null

No details available.

deprecated : bool|null

No details available.

security : list<OA\Security\Requirement>|null

No details available.

servers : list<OA\Server>|null

No details available.

externalDocs : OpenApi\Spec\ExternalDocumentation|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Operation\Get โ€‹

Shorthand for an HTTP GET operation.

Allows to shorten this:

php
#[OA\Operation(method: 'get', path: '/pets')]

to this:

php
#[OA\Operation\Get(path: '/pets')]

Parameters โ€‹


path : string|null

No details available.

webhook : string|null

No details available.

operationId : string|null

No details available.

summary : string|null

No details available.

description : string|null

No details available.

tags : list<string>|null

No details available.

parameters : list<Parameter>|null

No details available.

responses : list<Response>|null

No details available.

callbacks : array<string,mixed>|null

No details available.

deprecated : bool|null

No details available.

security : list<OA\Security\Requirement>|null

No details available.

servers : list<Server>|null

No details available.

externalDocs : OpenApi\Spec\ExternalDocumentation|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Operation\Head โ€‹

Shorthand for an HTTP HEAD operation.

Allows to shorten this:

php
#[OA\Operation(method: 'head', path: '/pets')]

to this:

php
#[OA\Operation\Head(path: '/pets')]

Parameters โ€‹


path : string|null

No details available.

webhook : string|null

No details available.

operationId : string|null

No details available.

summary : string|null

No details available.

description : string|null

No details available.

tags : list<string>|null

No details available.

parameters : list<OA\Parameter>|null

No details available.

responses : list<OA\Response>|null

No details available.

callbacks : array<string,mixed>|null

No details available.

deprecated : bool|null

No details available.

security : list<OA\Security\Requirement>|null

No details available.

servers : list<OA\Server>|null

No details available.

externalDocs : OpenApi\Spec\ExternalDocumentation|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Operation\Options โ€‹

Shorthand for an HTTP OPTIONS operation.

Allows to shorten this:

php
#[OA\Operation(method: 'options', path: '/pets')]

to this:

php
#[OA\Operation\Options(path: '/pets')]

Parameters โ€‹


path : string|null

No details available.

webhook : string|null

No details available.

operationId : string|null

No details available.

summary : string|null

No details available.

description : string|null

No details available.

tags : list<string>|null

No details available.

parameters : list<OA\Parameter>|null

No details available.

responses : list<OA\Response>|null

No details available.

callbacks : array<string,mixed>|null

No details available.

deprecated : bool|null

No details available.

security : list<OA\Security\Requirement>|null

No details available.

servers : list<OA\Server>|null

No details available.

externalDocs : OpenApi\Spec\ExternalDocumentation|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Operation\Patch โ€‹

Shorthand for an HTTP PATCH operation.

Allows to shorten this:

php
#[OA\Operation(method: 'patch', path: '/pets/{id}')]

to this:

php
#[OA\Operation\Patch(path: '/pets/{id}')]

Parameters โ€‹


path : string|null

No details available.

webhook : string|null

No details available.

operationId : string|null

No details available.

summary : string|null

No details available.

description : string|null

No details available.

tags : list<string>|null

No details available.

parameters : list<OA\Parameter>|null

No details available.

requestBody : OpenApi\Spec\RequestBody|null

No details available.

responses : list<OA\Response>|null

No details available.

callbacks : array<string,mixed>|null

No details available.

deprecated : bool|null

No details available.

security : list<OA\Security\Requirement>|null

No details available.

servers : list<OA\Server>|null

No details available.

externalDocs : OpenApi\Spec\ExternalDocumentation|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Operation\Post โ€‹

Shorthand for an HTTP POST operation.

Allows to shorten this:

php
#[OA\Operation(method: 'post', path: '/pets')]

to this:

php
#[OA\Operation\Post(path: '/pets')]

Parameters โ€‹


path : string|null

No details available.

webhook : string|null

No details available.

operationId : string|null

No details available.

summary : string|null

No details available.

description : string|null

No details available.

tags : list<string>|null

No details available.

parameters : list<OA\Parameter>|null

No details available.

requestBody : OpenApi\Spec\RequestBody|null

No details available.

responses : list<OA\Response>|null

No details available.

callbacks : array<string,mixed>|null

No details available.

deprecated : bool|null

No details available.

security : list<OA\Security\Requirement>|null

No details available.

servers : list<OA\Server>|null

No details available.

externalDocs : OpenApi\Spec\ExternalDocumentation|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Operation\Put โ€‹

Shorthand for an HTTP PUT operation.

Allows to shorten this:

php
#[OA\Operation(method: 'put', path: '/pets/{id}')]

to this:

php
#[OA\Operation\Put(path: '/pets/{id}')]

Parameters โ€‹


path : string|null

No details available.

webhook : string|null

No details available.

operationId : string|null

No details available.

summary : string|null

No details available.

description : string|null

No details available.

tags : list<string>|null

No details available.

parameters : list<OA\Parameter>|null

No details available.

requestBody : OpenApi\Spec\RequestBody|null

No details available.

responses : list<OA\Response>|null

No details available.

callbacks : array<string,mixed>|null

No details available.

deprecated : bool|null

No details available.

security : list<OA\Security\Requirement>|null

No details available.

servers : list<OA\Server>|null

No details available.

externalDocs : OpenApi\Spec\ExternalDocumentation|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Operation\Trace โ€‹

Shorthand for an HTTP TRACE operation.

Allows to shorten this:

php
#[OA\Operation(method: 'trace', path: '/pets')]

to this:

php
#[OA\Operation\Trace(path: '/pets')]

Parameters โ€‹


path : string|null

No details available.

webhook : string|null

No details available.

operationId : string|null

No details available.

summary : string|null

No details available.

description : string|null

No details available.

tags : list<string>|null

No details available.

parameters : list<OA\Parameter>|null

No details available.

responses : list<OA\Response>|null

No details available.

callbacks : array<string,mixed>|null

No details available.

deprecated : bool|null

No details available.

security : list<OA\Security\Requirement>|null

No details available.

servers : list<OA\Server>|null

No details available.

externalDocs : OpenApi\Spec\ExternalDocumentation|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Parameter โ€‹

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 component for the component key):

#[OA\Parameter\Path(component: 'petId', name: 'id', schema: new OA\Schema(type: 'integer'))]

Produces: components: parameters: petId: name: id in: path required: true schema: type: integer

Allowed in โ€‹


Components, Operation, PathItem

Nested elements โ€‹


Example, MediaType, MediaType\Json, MediaType\Xml

Parameters โ€‹


parameter : string|null

Deprecated since 6.12, removed in 8.0 - use `component` instead

name : string|null

The name of the parameter

in : string|ParameterIn|null

The location of the parameter (query, header, path, cookie)

description : string|null

A brief description of the parameter (CommonMark syntax)

required : bool|null

Whether the parameter is mandatory

deprecated : bool|null

Whether the parameter is deprecated

allowEmptyValue : bool|null

Whether empty-valued parameters are allowed

ref : string|Schema\Ref|null

A JSON Reference to a reusable parameter

style : string|ParameterStyle|null

How the parameter value is serialized

explode : bool|null

Whether arrays/objects generate separate parameters

allowReserved : bool|null

Whether reserved characters are allowed without encoding

schema : Schema|null

The schema defining the type for the parameter

example : mixed

Example of the parameter's value

examples : list<Example>|null

Examples of the parameter's value

content : MediaType|list<MediaType>|null

Content-type based parameter serialization

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


A parameter passed via an HTTP cookie.

Allows to shorten this:

php
#[OA\Parameter(name: 'session', in: 'cookie', schema: new OA\Schema(type: 'string'))]

to this:

php
#[OA\Parameter\Cookie(name: 'session', schema: new OA\Schema(type: 'string'))]

Allowed in โ€‹


Components, Operation, PathItem

Parameters โ€‹


parameter : string|null

No details available.

name : string|null

No details available.

description : string|null

No details available.

required : bool|null

No details available.

deprecated : bool|null

No details available.

ref : OpenApi\Spec\Schema\Ref|string|null

No details available.

explode : bool|null

No details available.

schema : OpenApi\Spec\Schema|null

No details available.

example : mixed|null

No details available.

examples : list<OA\Example>|null

No details available.

content : OA\MediaType|list<OA\MediaType>|null

No details available.

component : string|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Parameter\Header โ€‹

A parameter passed via an HTTP header.

Allows to shorten this:

php
#[OA\Parameter(name: 'X-Request-Id', in: 'header', schema: new OA\Schema(type: 'string'))]

to this:

php
#[OA\Parameter\Header(name: 'X-Request-Id', schema: new OA\Schema(type: 'string'))]

Allowed in โ€‹


Components, Operation, PathItem

Parameters โ€‹


parameter : string|null

No details available.

name : string|null

No details available.

description : string|null

No details available.

required : bool|null

No details available.

deprecated : bool|null

No details available.

ref : OpenApi\Spec\Schema\Ref|string|null

No details available.

explode : bool|null

No details available.

schema : OpenApi\Spec\Schema|null

No details available.

example : mixed|null

No details available.

examples : list<OA\Example>|null

No details available.

content : OA\MediaType|list<OA\MediaType>|null

No details available.

component : string|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Parameter\Path โ€‹

A parameter passed via the URL path (always required).

Allows to shorten this:

php
#[OA\Parameter(name: 'id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'))]

to this:

php
#[OA\Parameter\Path(name: 'id', schema: new OA\Schema(type: 'integer'))]

Allowed in โ€‹


Components, Operation, PathItem

Parameters โ€‹


parameter : string|null

No details available.

name : string|null

No details available.

description : string|null

No details available.

required : bool|null

No details available.

deprecated : bool|null

No details available.

ref : OpenApi\Spec\Schema\Ref|string|null

No details available.

style : OpenApi\Spec\ParameterStyle|string|null

No details available.

explode : bool|null

No details available.

schema : OpenApi\Spec\Schema|null

No details available.

example : mixed|null

No details available.

examples : list<OA\Example>|null

No details available.

content : OA\MediaType|list<OA\MediaType>|null

No details available.

component : string|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Parameter\Query โ€‹

A parameter passed via the URL query string.

Allows to shorten this:

php
#[OA\Parameter(name: 'limit', in: 'query', schema: new OA\Schema(type: 'integer'))]

to this:

php
#[OA\Parameter\Query(name: 'limit', schema: new OA\Schema(type: 'integer'))]

Allowed in โ€‹


Components, Operation, PathItem

Parameters โ€‹


parameter : string|null

No details available.

name : string|null

No details available.

description : string|null

No details available.

required : bool|null

No details available.

deprecated : bool|null

No details available.

allowEmptyValue : bool|null

No details available.

ref : OpenApi\Spec\Schema\Ref|string|null

No details available.

style : OpenApi\Spec\ParameterStyle|string|null

No details available.

explode : bool|null

No details available.

allowReserved : bool|null

No details available.

schema : OpenApi\Spec\Schema|null

No details available.

example : mixed|null

No details available.

examples : list<OA\Example>|null

No details available.

content : OA\MediaType|list<OA\MediaType>|null

No details available.

component : string|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


PathItem โ€‹

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).

Allowed in โ€‹


Components

Nested elements โ€‹


Parameter, Parameter\Cookie, Parameter\Header, Parameter\Path, Parameter\Query, Response, Security\Requirement, Server

Parameters โ€‹


ref : string|null

A JSON Reference to a reusable path item

prefix : string|null

Path prefix โ€” composable via class hierarchy

summary : string|null

An optional summary, intended to apply to all operations in this path

description : string|null

An optional description, intended to apply to all operations in this path

parameters : list<Parameter>|null

Parameters applicable to all operations under this path

servers : list<Server>|null

Alternative servers for all operations under this path

tags : list<string>|null

Tags to clone to contained operations

security : list<Security\Requirement>|null

Security requirements to clone to contained operations

responses : list<Response>|null

Shared responses to clone to contained operations

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Property โ€‹

Defines a single property within a Schema object.

The name comes from the property, parameter or constant the attribute sits on. A method supplies none, so a getter needs property: explicitly; without it the property is reported as missing one and omitted.

Allowed in โ€‹


Schema

Parameters โ€‹


property : string|null

The property name

schema : Schema|null

The schema defining the property type and constraints

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Property\Encoded โ€‹

Shortcut for a property that carries its own encoding definition.

Instead of declaring OA\Encoding separately on the OA\MediaType, this attribute bundles property and encoding together. The MediaTypes augmenter promotes the nested encoding to the parent MediaType automatically.

Allows to shorten this:

php
new OA\MediaType\Json(
    properties: [
        new OA\Property(property: 'avatar', schema: new OA\Schema(type: 'object')),
    ],
    encoding: [
        new OA\Encoding(encoding: 'avatar', contentType: 'image/png'),
    ],
)

to this:

php
new OA\MediaType\Json(
    properties: [
        new OA\Property\Encoded(
            property: 'avatar',
            schema: new OA\Schema(type: 'object'),
            encoding: new OA\Encoding(contentType: 'image/png'),
        ),
    ],
)

Allowed in โ€‹


Schema

Parameters โ€‹


property : string|null

The property name

schema : OA\Schema|null

The schema defining the property type and constraints

encoding : OpenApi\Spec\Encoding|null

No details available.

fan : OA\Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


RequestBody โ€‹

Describes a single request body.

Allowed in โ€‹


Components, Operation

Nested elements โ€‹


MediaType, MediaType\Json, MediaType\Xml

Parameters โ€‹


request : string|null

Deprecated since 6.12, removed in 8.0 - use `component` instead

description : string|null

A brief description of the request body (CommonMark syntax)

required : bool|null

Whether the request body is required

ref : string|Schema\Ref|null

A JSON Reference to a reusable request body

content : MediaType|list<MediaType>|Schema|null

The content of the request body; a bare `Schema` is the payload of one media type, which `Augmenter\DefaultMediaType` fills in

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Response โ€‹

Describes a single response from an API operation.

Allowed in โ€‹


Components, Operation, PathItem

Nested elements โ€‹


Header, Link, MediaType, MediaType\Json, MediaType\Xml

Parameters โ€‹


response : string|int|null

The HTTP status code, a range such as '2XX', or 'default' โ€” the key the response nests under in an operation

description : string|null

A description of the response (CommonMark syntax)

ref : string|Schema\Ref|null

A JSON Reference to a reusable response

headers : list<Header>|null

Headers sent with the response

content : MediaType|list<MediaType>|Schema|null

Possible response payloads; a bare `Schema` is the payload of one media type, which `Augmenter\DefaultMediaType` fills in

links : list<Link>|null

Design-time links for the response

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Schema โ€‹

Defines 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:

Inline โ€” used within parameters, responses, or other schemas:

new OA\Schema(type: 'array', items: new OA\Schema(ref: Pet::class))

Only a class supplies a name. On a method or a parameter, pass schema: explicitly; without it the schema has no component key and is reported as missing one.

Allowed in โ€‹


Components

Nested elements โ€‹


Property, Property\Encoded

Parameters โ€‹


schema : string|null

Deprecated since 6.12, removed in 8.0 - use `component` instead

title : string|null

A title for the schema

description : string|null

A description of the schema (CommonMark syntax)

ref : string|null

A JSON Reference to a reusable schema

type : string|Type|list<string|Type>|null

The value type(s) (string, number, integer, boolean, array, object, null)

format : string|Format|null

Further refines the type (e.g. int32, int64, float, double, date-time, email)

nullable : bool|null

Whether the value can be null (OAS 3.0 only; use type array in 3.1+)

minLength : int|null

Minimum string length

maxLength : int|null

Maximum string length

pattern : string|null

Regular expression pattern the string must match

contentMediaType : string|null

The media type of string content encoding

contentEncoding : string|null

The encoding used for string content (e.g. base64)

contentSchema : Schema|null

Schema for the decoded content described by contentMediaType

minimum : int|float|null

Minimum numeric value (inclusive)

maximum : int|float|null

Maximum numeric value (inclusive)

exclusiveMinimum : int|float|bool|null

Exclusive minimum value

exclusiveMaximum : int|float|bool|null

Exclusive maximum value

multipleOf : int|float|null

The value must be a multiple of this number

items : Schema|string|null

Schema for array items

minItems : int|null

Minimum number of array items

maxItems : int|null

Maximum number of array items

uniqueItems : bool|null

Whether array items must be unique

prefixItems : list<Schema>|null

Schemas for positional array items (tuple validation)

contains : Schema|bool|null

Schema that at least one array item must match

minContains : int|null

Minimum number of items matching contains

maxContains : int|null

Maximum number of items matching contains

unevaluatedItems : Schema|bool|null

Schema for items not covered by other keywords

properties : array<array-key,Property|Schema|Type|Format>|null

Object property definitions, as a list of `Property` or keyed by property name

required : list<string>|null

List of required property names

additionalProperties : Schema|Schema\AdditionalProperties|bool|null

Schema or boolean for additional properties

patternProperties : array<string,Schema>|null

Schemas for properties matching regex patterns

minProperties : int|null

Minimum number of properties

maxProperties : int|null

Maximum number of properties

unevaluatedProperties : Schema|bool|null

Schema for properties not covered by other keywords

propertyNames : Schema|null

Schema that property names must validate against

dependentRequired : array<string,list<string>>|null

Property-level required dependencies

dependentSchemas : array<string,Schema>|null

Property-level schema dependencies

allOf : list<Schema>|null

All schemas must match (AND composition)

anyOf : list<Schema>|null

At least one schema must match (OR composition)

oneOf : list<Schema>|null

Exactly one schema must match (XOR composition)

not : Schema|null

The schema must NOT match

if : Schema|null

Conditional schema (if-then-else)

then : Schema|null

Applied when 'if' succeeds

else : Schema|null

Applied when 'if' fails

enum : list<string|int|float|bool|\UnitEnum|class-string<\UnitEnum>|null>|null

Allowed values

const : mixed

A single allowed value

example : mixed

An example value

examples : list<mixed>|null

A list of example values

deprecated : bool|null

Whether the schema is deprecated

readOnly : bool|null

Whether the value is read-only

writeOnly : bool|null

Whether the value is write-only

default : mixed

The default value

discriminator : Discriminator|null

Discriminator for polymorphism

externalDocs : ExternalDocumentation|null

Additional external documentation

xml : Xml|null

XML representation metadata

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Schema\AdditionalProperties โ€‹

Typed alias for Schema used as the additionalProperties value.

Identical to OA\Schema in functionality โ€” exists for readability when declaring schemas with constrained additional properties:

php
new OA\Schema(
    type: 'object',
    additionalProperties: new OA\Schema\AdditionalProperties(type: 'string'),
)

Allowed in โ€‹


Components

Parameters โ€‹


schema : string|null

Deprecated since 6.12, removed in 8.0 - use `component` instead

title : string|null

A title for the schema

description : string|null

A description of the schema (CommonMark syntax)

ref : string|null

A JSON Reference to a reusable schema

type : string|Type|list<string|Type>|null

The value type(s) (string, number, integer, boolean, array, object, null)

format : string|Format|null

Further refines the type (e.g. int32, int64, float, double, date-time, email)

nullable : bool|null

Whether the value can be null (OAS 3.0 only; use type array in 3.1+)

minLength : int|null

Minimum string length

maxLength : int|null

Maximum string length

pattern : string|null

Regular expression pattern the string must match

contentMediaType : string|null

The media type of string content encoding

contentEncoding : string|null

The encoding used for string content (e.g. base64)

contentSchema : Schema|null

Schema for the decoded content described by contentMediaType

minimum : int|float|null

Minimum numeric value (inclusive)

maximum : int|float|null

Maximum numeric value (inclusive)

exclusiveMinimum : int|float|bool|null

Exclusive minimum value

exclusiveMaximum : int|float|bool|null

Exclusive maximum value

multipleOf : int|float|null

The value must be a multiple of this number

items : Schema|string|null

Schema for array items

minItems : int|null

Minimum number of array items

maxItems : int|null

Maximum number of array items

uniqueItems : bool|null

Whether array items must be unique

prefixItems : list<Schema>|null

Schemas for positional array items (tuple validation)

contains : Schema|bool|null

Schema that at least one array item must match

minContains : int|null

Minimum number of items matching contains

maxContains : int|null

Maximum number of items matching contains

unevaluatedItems : Schema|bool|null

Schema for items not covered by other keywords

properties : array<array-key,Property|Schema|Type|Format>|null

Object property definitions, as a list of `Property` or keyed by property name

required : list<string>|null

List of required property names

additionalProperties : Schema|Schema\AdditionalProperties|bool|null

Schema or boolean for additional properties

patternProperties : array<string,Schema>|null

Schemas for properties matching regex patterns

minProperties : int|null

Minimum number of properties

maxProperties : int|null

Maximum number of properties

unevaluatedProperties : Schema|bool|null

Schema for properties not covered by other keywords

propertyNames : Schema|null

Schema that property names must validate against

dependentRequired : array<string,list<string>>|null

Property-level required dependencies

dependentSchemas : array<string,Schema>|null

Property-level schema dependencies

allOf : list<Schema>|null

All schemas must match (AND composition)

anyOf : list<Schema>|null

At least one schema must match (OR composition)

oneOf : list<Schema>|null

Exactly one schema must match (XOR composition)

not : Schema|null

The schema must NOT match

if : Schema|null

Conditional schema (if-then-else)

then : Schema|null

Applied when 'if' succeeds

else : Schema|null

Applied when 'if' fails

enum : list<string|int|float|bool|\UnitEnum|class-string<\UnitEnum>|null>|null

Allowed values

const : mixed

A single allowed value

example : mixed

An example value

examples : list<mixed>|null

A list of example values

deprecated : bool|null

Whether the schema is deprecated

readOnly : bool|null

Whether the value is read-only

writeOnly : bool|null

Whether the value is write-only

default : mixed

The default value

discriminator : Discriminator|null

Discriminator for polymorphism

externalDocs : ExternalDocumentation|null

Additional external documentation

xml : Xml|null

XML representation metadata

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Schema\Items โ€‹

Shortcut for OA\Schema with type array and items.

Allows to shorten this:

php
#[OA\Schema]
class Pet {
    #[OA\Property]
    #[OA\Schema(type: 'array', items: new OA\Schema(ref: MyModel::class))]
    public array $names;
}

to this:

php
#[OA\Schema]
class Pet {
    #[OA\Schema\Items(ref: MyModel::class)]
    public array $names;
}

Since Items extends Schema, the implicit OA\Property shortcut applies โ€” no explicit #[OA\Property] is needed. The Shortcuts augmenter wraps this into OA\Schema(type: 'array', items: ...) automatically.

Allowed in โ€‹


Components

Parameters โ€‹


schema : string|null

Deprecated since 6.12, removed in 8.0 - use `component` instead

title : string|null

A title for the schema

description : string|null

A description of the schema (CommonMark syntax)

ref : string|null

A JSON Reference to a reusable schema

type : string|Type|list<string|Type>|null

The value type(s) (string, number, integer, boolean, array, object, null)

format : string|Format|null

Further refines the type (e.g. int32, int64, float, double, date-time, email)

nullable : bool|null

Whether the value can be null (OAS 3.0 only; use type array in 3.1+)

minLength : int|null

Minimum string length

maxLength : int|null

Maximum string length

pattern : string|null

Regular expression pattern the string must match

contentMediaType : string|null

The media type of string content encoding

contentEncoding : string|null

The encoding used for string content (e.g. base64)

contentSchema : Schema|null

Schema for the decoded content described by contentMediaType

minimum : int|float|null

Minimum numeric value (inclusive)

maximum : int|float|null

Maximum numeric value (inclusive)

exclusiveMinimum : int|float|bool|null

Exclusive minimum value

exclusiveMaximum : int|float|bool|null

Exclusive maximum value

multipleOf : int|float|null

The value must be a multiple of this number

items : Schema|string|null

Schema for array items

minItems : int|null

Minimum number of array items

maxItems : int|null

Maximum number of array items

uniqueItems : bool|null

Whether array items must be unique

prefixItems : list<Schema>|null

Schemas for positional array items (tuple validation)

contains : Schema|bool|null

Schema that at least one array item must match

minContains : int|null

Minimum number of items matching contains

maxContains : int|null

Maximum number of items matching contains

unevaluatedItems : Schema|bool|null

Schema for items not covered by other keywords

properties : array<array-key,Property|Schema|Type|Format>|null

Object property definitions, as a list of `Property` or keyed by property name

required : list<string>|null

List of required property names

additionalProperties : Schema|Schema\AdditionalProperties|bool|null

Schema or boolean for additional properties

patternProperties : array<string,Schema>|null

Schemas for properties matching regex patterns

minProperties : int|null

Minimum number of properties

maxProperties : int|null

Maximum number of properties

unevaluatedProperties : Schema|bool|null

Schema for properties not covered by other keywords

propertyNames : Schema|null

Schema that property names must validate against

dependentRequired : array<string,list<string>>|null

Property-level required dependencies

dependentSchemas : array<string,Schema>|null

Property-level schema dependencies

allOf : list<Schema>|null

All schemas must match (AND composition)

anyOf : list<Schema>|null

At least one schema must match (OR composition)

oneOf : list<Schema>|null

Exactly one schema must match (XOR composition)

not : Schema|null

The schema must NOT match

if : Schema|null

Conditional schema (if-then-else)

then : Schema|null

Applied when 'if' succeeds

else : Schema|null

Applied when 'if' fails

enum : list<string|int|float|bool|\UnitEnum|class-string<\UnitEnum>|null>|null

Allowed values

const : mixed

A single allowed value

example : mixed

An example value

examples : list<mixed>|null

A list of example values

deprecated : bool|null

Whether the schema is deprecated

readOnly : bool|null

Whether the value is read-only

writeOnly : bool|null

Whether the value is write-only

default : mixed

The default value

discriminator : Discriminator|null

Discriminator for polymorphism

externalDocs : ExternalDocumentation|null

Additional external documentation

xml : Xml|null

XML representation metadata

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Schema\Ref โ€‹

A reference-only schema โ€” $ref is required, most other Schema properties are unavailable.

In OpenAPI 3.1+, $ref can be combined with title and description to override the referenced schema's metadata without duplicating the definition.

Usage:

php
#[OA\Property(schema: new OA\Schema\Ref(ref: Pet::class))]
#[OA\Property(schema: new OA\Schema\Ref(ref: '#/components/schemas/Pet', title: 'The pet'))]
#[OA\Property(schema: new OA\Schema\Ref(ref: Pet::class, description: 'Override desc'))]

If used on a $ref directly, only the ref value is used.

Allowed in โ€‹


Components

Parameters โ€‹


ref : string

No details available.

title : string|null

No details available.

description : string|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Security\Requirement โ€‹

A 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.

Replaces the raw array form:

php
#[OA\Operation\Get(path: '/pets', security: [['apiKey' => []]])]

with:

php
#[OA\Operation\Get(path: '/pets', security: [new OA\Security\Requirement(scheme: 'apiKey')])]

// both schemes at once
new OA\Security\Requirement(schemes: ['apiKey' => [], 'oauth' => ['read:pets']])

Allowed in โ€‹


OpenApi, Operation, PathItem

Parameters โ€‹


scheme : string|null

Single scheme name (shorthand for simple requirements)

scopes : list<string>|null

Scopes for the single scheme (OAuth2/OpenIdConnect)

schemes : array<string,list<string>>|null

Map of scheme names to scopes (for AND logic with multiple schemes)

fan : OA\Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Security\Scheme โ€‹

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 cookie
  • OA\Security\Scheme\OAuth2 - OAuth2 with one or more flows
  • OA\Security\Scheme\OpenIdConnect - OpenID Connect discovery
  • OA\Security\Scheme\MutualTls - Mutual TLS authentication

Example:

php
#[OA\Security\Scheme(component: 'bearerAuth', type: 'http', scheme: 'bearer')]

Allowed in โ€‹


Components

Nested elements โ€‹


Flow, Flow\AuthorizationCode, Flow\ClientCredentials, Flow\Implicit, Flow\Password

Parameters โ€‹


securityScheme : string|null

Deprecated since 6.12, removed in 8.0 - use `component` instead

type : string|OA\SchemeType|null

The type of the security scheme (apiKey, http, mutualTLS, oauth2, openIdConnect)

description : string|null

A description of the security scheme (CommonMark syntax)

name : string|null

The name of the header, query, or cookie parameter (apiKey)

in : string|OA\SchemeIn|null

The location of the API key (query, header, cookie)

scheme : string|null

The HTTP authorization scheme (http)

bearerFormat : string|null

A hint about the format of the bearer token (http/bearer)

openIdConnectUrl : string|null

The OpenID Connect URL to discover configuration (openIdConnect)

flows : list<OA\Flow>|null

The available OAuth2 flows (oauth2)

ref : string|null

A JSON Reference to a reusable security scheme

component : string|null

The key this is filed under in `components`, which makes it a reusable component

fan : OA\Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Security\Scheme\ApiKey โ€‹

An API key security scheme (header, query, or cookie).

Allows to shorten this:

php
#[OA\Security\Scheme(
    component: 'apiKey',
    type: 'apiKey',
    name: 'X-API-Key',
    in: 'header',
)]

to this:

php
#[OA\Security\Scheme\ApiKey(
    component: 'apiKey',
    name: 'X-API-Key',
    in: 'header',
)]

Allowed in โ€‹


Components

Parameters โ€‹


securityScheme : string|null

No details available.

description : string|null

No details available.

name : string|null

No details available.

in : OpenApi\Spec\SchemeIn|string|null

No details available.

component : string|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Security\Scheme\Http โ€‹

An HTTP authentication security scheme (Basic, Bearer, etc.).

Allows to shorten this:

php
#[OA\Security\Scheme(
    component: 'bearerAuth',
    type: 'http',
    scheme: 'bearer',
    bearerFormat: 'JWT',
)]

to this:

php
#[OA\Security\Scheme\Http(
    component: 'bearerAuth',
    scheme: 'bearer',
    bearerFormat: 'JWT',
)]

Allowed in โ€‹


Components

Parameters โ€‹


securityScheme : string|null

No details available.

description : string|null

No details available.

scheme : string|null

No details available.

bearerFormat : string|null

No details available.

component : string|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Security\Scheme\MutualTls โ€‹

A Mutual TLS security scheme.

Allows to shorten this:

php
#[OA\Security\Scheme(
    component: 'mtls',
    type: 'mutualTLS',
)]

to this:

php
#[OA\Security\Scheme\MutualTls(
    component: 'mtls',
)]

Allowed in โ€‹


Components

Parameters โ€‹


securityScheme : string|null

No details available.

description : string|null

No details available.

component : string|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Security\Scheme\OAuth2 โ€‹

An OAuth2 security scheme with one or more flows.

Allows to shorten this:

php
#[OA\Security\Scheme(
    component: 'oauth',
    type: 'oauth2',
    flows: [new OA\Flow\ClientCredentials(tokenUrl: 'https://example.com/oauth/token', scopes: [])],
)]

to this:

php
#[OA\Security\Scheme\OAuth2(
    component: 'oauth',
    flows: [new OA\Flow\ClientCredentials(tokenUrl: 'https://example.com/oauth/token', scopes: [])],
)]

Allowed in โ€‹


Components

Parameters โ€‹


securityScheme : string|null

No details available.

description : string|null

No details available.

flows : list<OA\Flow>|null

No details available.

component : string|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Security\Scheme\OpenIdConnect โ€‹

An OpenID Connect Discovery security scheme.

Allows to shorten this:

php
#[OA\Security\Scheme(
    component: 'oidc',
    type: 'openIdConnect',
    openIdConnectUrl: 'https://example.com/.well-known/openid-configuration',
)]

to this:

php
#[OA\Security\Scheme\OpenIdConnect(
    component: 'oidc',
    openIdConnectUrl: 'https://example.com/.well-known/openid-configuration',
)]

Allowed in โ€‹


Components

Parameters โ€‹


securityScheme : string|null

No details available.

description : string|null

No details available.

openIdConnectUrl : string|null

No details available.

component : string|null

No details available.

fan : OpenApi\Spec\Fan|null

No details available.

Reference โ€‹


Server โ€‹

A host the API is available on, optionally templated with ServerVariable substitutions.

Allowed in โ€‹


Operation, PathItem

Nested elements โ€‹


ServerVariable

Parameters โ€‹


url : string|null

A URL to the target host

description : string|null

A description of the host (CommonMark syntax)

variables : list<ServerVariable>|null

Variables for server URL template substitution

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


ServerVariable โ€‹

The allowed and default substitutions for one template variable in a Server URL.

Allowed in โ€‹


Server

Parameters โ€‹


serverVariable : string|null

The variable name

default : string|null

The default value to use for substitution

description : string|null

A description of the server variable (CommonMark syntax)

enum : list<string|int|float|bool|\UnitEnum|class-string<\UnitEnum>|null>|null

Allowed values for substitution; all cast to string in the specification

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Tag โ€‹

Adds metadata to a single tag used by the Operation Object.

On a method or a class, the tag is also added to the operations declared there: a method's own, or every operation of the class. On a class with no operations it only declares the tag.

Nested elements โ€‹


ExternalDocumentation

Parameters โ€‹


name : string|null

The name of the tag

summary : string|null

A short summary of the tag, used for display purposes

description : string|null

A description of the tag (CommonMark syntax)

externalDocs : ExternalDocumentation|null

Additional external documentation for this tag

parent : string|null

The name of a tag that this tag is nested under

kind : string|null

A machine-readable string to categorize the tag

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹


Xml โ€‹

Metadata for XML representation of a schema property.

Allowed in โ€‹


Schema

Parameters โ€‹


name : string|null

Replaces the name of the element/attribute

namespace : string|null

The URI of the XML namespace

prefix : string|null

The namespace prefix to use

attribute : bool|null

Whether the property translates to an XML attribute

wrapped : bool|null

Whether array items are wrapped in an additional element

fan : Fan|null

Where this attribute goes when more than one attribute could hold it

Reference โ€‹