api-platform / api-platform/core

Array query parameters not correctly handled by OpenAPI UI

Abierto
#8,421 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
PHP
Estrellas
2.6k
Forks
980
Merge medio
2 d 5 h
PR fusionados (30 d)
48

Descripción

**Description**

When setting a Query Parameter of array type, the OpenAPI UI allows setting multiple values but makes a wrong setup of the actual query parameters (no `[]` added).

Alternatively, is there a simple way to configure the parsing from Laravel/Symfony to access all provided values? It seems a lot of this is framework and language specific, as other languages support multiple query param with same name as is implemented here.

**How to reproduce**

```
#[ApiResource(
shortName: 'Test',
operations: [
new Get(
parameters: [
'array' => new QueryParameter(required: false, castToArray: true, schema: ['type' => 'array']),
],
),
],
)]
class Test2Resource
{
public int $not_id;
}

```

Image

**Possible Solution**

```

curl -X 'GET' \
'http://localhost/fork/public/api/tests?array=2&array=1&array=4' \
-H 'accept: application/ld+json'

```

should be
```

curl -X 'GET' \
'http://localhost/fork/public/api/tests?array[]=2&array[]=1&array[]=4' \
-H 'accept: application/ld+json')

```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.