api-platform / api-platform/core

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

Aperta
#2,128 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
GraphQL Has a PR
Lingua principale
PHP
Stelle
2.6k
Fork
980
Merge medio
2g 5h
PR unite (30g)
48

Descrizione

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]` |

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.