-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
... however coercion from int does (arguably coercion from string is more useful than coercion from int).
Schema:
enum Color { blue, orange, green } // mapped to 1, 2, 3
type Favorite {
id: ID!
color: Color
}
Client:
curl -XPOST -H 'Content-Type:application/graphql' -d '{"query":"mutation createFavorite($color: Color!) { createFavorite(color:$color) { color } }", "params":{"color":2}}' http://localhost:3000/graphql
{
"data": {
"createFavorite": null // Server is returning null at the moment but server logs are pasted below.
}
}
Server:
Received insert request: uid: c4e1dd90-9b89-4fcf-8b6b-c32e9f63dccb, entity: Favorite, params: {"color" "{\"orange\" {
Returning: null
Bad request:
curl -XPOST -H 'Content-Type:application/graphql' -d '{"query":"mutation createFavorite($color: Color!) { createFavorite(color:$color) { color } }", "params":{"color":"orange"}}' http://localhost:3000/graphql
{
"errors": [
{
"message": "Variable $color expected value of type Color! but got: \"orange\".",
"stack": "Variable $color expected value of type Color! but got: \"orange\".",
"locations": [
{
"line": 1,
"column": 25
}
]
}
]
}
Metadata
Metadata
Assignees
Labels
No labels