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 摘要。