api-platform / api-platform/core
[Graphql] Handle the type for an array of a scalar-type
- Dominant language
- PHP
- Stars
- 2.6k
- Forks
- 980
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 48
Description
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]` |
Contributor guide
Assessment
This issue has not been assessed yet.