Add Example Value for 'page' Parameter and Clarify Handling of Empty 'page' Values
Los mantenedores suelen responder en 1 día
@soyuka ya está trabajando en esto.
Desde el 13/5/2025.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Description
Currently, the page query parameter in API Platform OpenAPI documentation is defined with a default value of 1 but lacks an example value. This absence can lead to issues with tools like ApiDog, which may import and activate the page parameter without an example.
Resulting in requests such as: url.org?page= by default after import.
Such requests cause failures ‘Page should not be less than 1‘ due to the empty page parameter.
Proposed Solution
1. Add an Example Value to the page Parameter
To align with the OpenAPI specification and improve compatibility with tools that consume OpenAPI, it is recommended to add an example value of 1 to the page parameter. This can be achieved by modifying the parameter definition as follows:
$parameters[] = new Parameter(
$this->paginationOptions->getPaginationPageParameterName(),
'query',
'The collection page number',
false,
false,
true,
['type' => 'integer', 'default' => 1],
example: 1
);
2. Define Behavior for Empty page Parameter Values
Clarify how API Platform should handle cases where the page parameter is provided with an empty value. There are two potential approaches:
- Fallback to Default: Treat an empty page value as if the default value (1) was provided.
- Return Bad Request (current behavior): Respond with a 400 Bad Request status, indicating that the page parameter should not be empty.
I am open to working on a PR to implement this change if the proposal is accepted.
- Lenguaje dominante
- PHP
- Estrellas
- 2.6k
- Forks
- 989
- Merge medio
- 1 d 22 h
- PR fusionados (30 d)
- 100
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de api-platform/core
-
JSON:API: resource schemas (`*.jsonapi`) have `properties` but no `type: object`Posiblemente ocupada @ousamabenyounes la tomó hace 3 días. Abierto
Dificultad 2/5 Menos de una hora Aptitud para principiantes 80/100
api-platform/core#8701 ·
Los mantenedores suelen responder en 1 día
-
JSON:API: `JsonApiCollectionBaseSchemaNoPagination` declares `data` as `type: array` without `items`Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
api-platform/core#8699 ·
Los mantenedores suelen responder en 1 día
-
[Json-Schema] Nested resources lost externalDoc and description dataPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
api-platform/core#8721 ·
Los mantenedores suelen responder en 1 día
-
JSON:API: 404/405 router errors are empty, and error objects have a non-spec `type` memberPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 50/100
api-platform/core#8704 ·
Los mantenedores suelen responder en 1 día
-
JSON:API: request documents with no `data`, no `type` or a wrong `type` are accepted with 201Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
api-platform/core#8703 ·
Los mantenedores suelen responder en 1 día
Todos los issues de api-platform/core
Issues similares
-
sync-en
Dificultad 1/5 Menos de una hora Aptitud para principiantes 77/100
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
verbb/formie#3022 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Automattic/blocks-engine#3090 ·
Los mantenedores suelen responder en 1 día
-
(php): ORT workflow always fails due to incompatibility between Pluggy 1.7.0 and Scancode-Toolkit 32.5.0Posiblemente ocupada @leslie-bq la tomó hace 3 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
valkey-io/valkey-glide-php#375 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100