purescript-graphql
purescript-graphql copied to clipboard
Default values for arguments and input type fields
Currently it is not possible to add default values for field arguments and input fields. Ideally we could introduce a new function (and operator alias) withDefaultValue. If there is no value provided for a variable that has a default value we can use the default value.
withDefaultValue :: forall a n. Symbol n => Tuple (SProxy n) (Argument a) -> a -> Tuple (SProxy n) (Argument a)
withDefaultValue (Tuple name arg) defaultValue = ???
-- Usage
mutationType :: GQL.ObjectType Context Unit
mutationType = GQL.objectType "Mutation"
:> GQL.field "myMutation" Scalar.boolean
?> GQL.arg GQLScalar.id (SProxy :: SProxy "id") `withDefaultValue` "123"