You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then with the object new Url(type: UrlType::WEBSITE), the returned JSON will be something along the lines of:
{
"url": {
"type": "WEBSITE"
}
}
Note how it is the GraphQL UrlTypename that is used to return the value. If you submit type: WEBSITE in GraphQL, then the value serialized to PHP will be 'website'.
Now the issue: make UrlType into a backed string enum instead:
I do not know what is correct from the GraphQL spec perspective, but surely having such different behaviour when transforming a pseudo-enum into a backed enum seems incorrect?
The text was updated successfully, but these errors were encountered:
From #1608,
BackedEnum
are resolved as follows:I find this serialization a bit strange. Indeed if you consider the following object:
with the following GraphQL configuration (using OverblogGraphQLBundle):
And the following class:
Then with the object
new Url(type: UrlType::WEBSITE)
, the returned JSON will be something along the lines of:Note how it is the GraphQL
UrlType
name that is used to return the value. If you submittype: WEBSITE
in GraphQL, then the value serialized to PHP will be'website'
.Now the issue: make
UrlType
into a backed string enum instead:Then the JSON response will now be:
I do not know what is correct from the GraphQL spec perspective, but surely having such different behaviour when transforming a pseudo-enum into a backed enum seems incorrect?
The text was updated successfully, but these errors were encountered: