api-platform / api-platform/core

Array query parameters not correctly handled by OpenAPI UI

未關閉
#8,421 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
PHP
星號
2.6k
分支
980
平均合併
2 天 5 小時
30 天內合併 PR
48

描述

**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')

```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。