Core: [BUG] Can't disable pagination for custom operation

Created on 4 Jul 2018  路  2Comments  路  Source: api-platform/core

My annotation:

 * @ApiResource(
*  attributes={"pagination_enabled"=false},
 *  itemOperations={
 *     "get",
 *     "post"={
 *         "method"="POST",
 *         "route_name"="api_widget_settings"
 *      }
 *  },
 *  collectionOperations={
 *     "get",
 *     "post"={
 *         "method"="POST",
 *         "route_name"="api_widget_settings"
 *      }
 * }))

The controller action:

    /**
     * @Route("/widget/settings",
     *     name="widget_api_settings",
     *     defaults={
     *          "_api_resource_class"=Settings::class,
     *          "_api_collection_operation_name"="get",
     *          "pagination_enabled"=false
     * })
     */

I tried both options to disable the page parameter, but nothing happend.

Most helpful comment

/**
 * @ApiResource(
 *     attributes={ "normalization_context"={"groups"={"read"}}},
 *     collectionOperations={
 *          "get"={
 *              "pagination_enabled"=false,
 *              "method"="GET",
 *              "swagger_context"={
 *                  "parameters"={
 *                      {
 *                          "name"="email",
 *                          "in"="path",
 *                          "required"=true,
 *                          "type"="string",
 *                          "description"="User email"
 *                      }
 *                  }
 *              }
 *          }
 *     }
 * )
 */

You need to specify ("pagination_enabled"=false) in the operation itself

All 2 comments

/**
 * @ApiResource(
 *     attributes={ "normalization_context"={"groups"={"read"}}},
 *     collectionOperations={
 *          "get"={
 *              "pagination_enabled"=false,
 *              "method"="GET",
 *              "swagger_context"={
 *                  "parameters"={
 *                      {
 *                          "name"="email",
 *                          "in"="path",
 *                          "required"=true,
 *                          "type"="string",
 *                          "description"="User email"
 *                      }
 *                  }
 *              }
 *          }
 *     }
 * )
 */

You need to specify ("pagination_enabled"=false) in the operation itself

Thanks @mkSpitfire this should do the trick

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gustawdaniel picture gustawdaniel  路  3Comments

soyuka picture soyuka  路  3Comments

theshaunwalker picture theshaunwalker  路  3Comments

kate-kate picture kate-kate  路  3Comments

CvekCoding picture CvekCoding  路  3Comments