Partials — Swagger-PHP documentation

### Navigation

- previous
- Swagger-PHP documentation »

# Partials

Note

This is the documentation for (older / unsupported) swagger-php v1.x
Go to the swagger-php v3.x documentation

To avoid duplication swagger-php introduces partials.

## Defining a partial

Any swagger annotation can become a partial by addding the property “partial”.

    /**
     * @SWG\Parameter(partial="path_id", name="id", paramType="path", type="integer")
     * @SWG\ResponseMessage(partial="error404", code=404, message="Entity not found")
     */

## Using a partial

    /**
     * @SWG\Operation(
     *   method="GET",
     *   nickname="partialDemo"
     *   @SWG\Partial("path_id"),
     *   @SWG\Partial("error404"),
     * )
     */

Output:

    operations: [
      {
        method: "GET",
        nickname: "partialDemo",
        parameters: [
          {
            paramType: "path",
            name: "id",
            type: "integer"
          }
        ],
        responseMessages: [
          {
            code: 404,
            message: "Entity not found"

          }
        ]
      }
    ]

### Navigation

- previous
- Swagger-PHP documentation »