Skip to content

Shortcuts

To help keeping your annotations simple, there are a few shortcut annotations available in swagger-php. Typically, these safe you from creating boilerplate nested OA\Schema annotations.

OA\MediaType

OA\MediaType is used to describe the content of a response.

For JSON and Xml content, swagger-php provides shortcut annotations to avoid having to specify the mediaType over and over again.

Example using OA\JsonContent

During processing the OA\JsonContent unwraps to OA\MediaType(mediaType="application/json", OA\Schema(...) and will generate the same output.

The same applies to OA\XmlContent.

OA\Parameter

The OA\Parameter annotation requires specifying the in property to indicate where in the request the parameter is located.

Shortcut annotations are available for OA\PathParameter, OA\QueryParameter, OA\CookieParameter and OA\HeaderParameter.