Back to Swagger Php

Preamble Spec Attributes

docs/snippets/preamble_spec-attributes.md

6.6.0779 B
Original Source

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