Closed
Description
Hi,
It seems that if a nested input object is not supplied, the default values are not applied either;
const SomeConfig = new GraphQLInputObjectType({
name: "X",
fields: {
foo: { type: GraphQLInt, defaultValue: 0 }
}
})
const Query = new GraphQLObjectType({
name: "Query",
fields: {
someQuery: {
type: GraphQLString,
args: {
bar: { type: SomeConfig, defaultValue: {} }
},
resolve(parent, args) {
// if no bar is supplied and bar has no defaultvalue, args.bar is null, this is expected.
// if bar arg has a defaultValue: {} as above
// args.bar.foo is not populated, args becomes {}
}
}
}
});
How can I make sure that the entire nested argument graph is populated with their default values?