api-platform / api-platform/core

[Graphql] Handle the type for an array of a scalar-type

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

描述

When a property is defined as an `array` or a `string[]` in an entity, it will be convert as an `Iterable` type by the graphql schema builder.

The `Iterable` type is not well supported by the apollo library for IOS (and not at all for Android) as an Iterable may be :
* an array of string
* an array of int
* an array of bool
* an array of float
* a dictionnary : an array of key/value
* an array of json-object

In my current use-case, the apollo client can not determine how to parse an `Iterable`.
To limit the mis-interpretation by a graphql client, it will be better to clearly identify an array of string and avoid using the Iterable graphql type for the scalar.

The idea is to generate the following association for the scalar types :

| PHP type | GraphQl type |
|--|--|
| `@var array` | `Iterable` |
| `@var string[]` | `[StringType]` |
| `@var int[]` | `[IntegerType]` |
| `@var float[]` | `[FloatType]` |
| `@var bool[]` | `[BooleanType]` |

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

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

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