GraphQLBundle
GraphQLBundle copied to clipboard
Arbitrary default value for a field of enum type
| Q | A |
|---|---|
| Bug report? | yes |
| Feature request? | no |
| BC Break report? | no |
| RFC? | no |
| Version/Branch | 0.13 |
Hey.
I noticed that it is possible to assign an arbitrary default value for a field of a enum type (out of enum value set), and this value successfuly passes to the resolver without any warning or error. Is this okay?
CustomerFilter:
type: input-object
config:
fields:
searchType:
type: SearchType
defaultValue: customer1
SearchType:
type: enum
config:
values:
CUSTOMER:
value: 'customer'
CUSTOMER_CORPORATE:
value: 'customer_corporate'
Somewhere in the code:
$searchType = $args->offsetGet('filter')['searchType']; // === 'customer1'
I'd have expected the default value to be validated against the value set of the enum type in the same way as the real input value so that the value "customer1" will never get to the code.