api-platform / api-platform/core

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

Offen
#2,128 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
GraphQL Has a PR
Vorherrschende Sprache
PHP
Sterne
2.6k
Forks
980
Ø Merge
2 T. 5 Std.
Gemergte PRs (30 T.)
48

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.