api-platform / api-platform/core

Array query parameters not correctly handled by OpenAPI UI

オープン
#8,421 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
PHP
スター
2.6k
フォーク
980
平均マージ
2日 5時間
マージ済み PR(30日)
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 を短くまとめたダイジェスト。