codegeek001
09/23/2017, 3:49 AMconst SearchType = new GraphQLObjectType({
name: 'search',
fields: () => ({
type: { type: GraphQLString },
params: {
type: new GraphQLObjectType({
name: 'params',
fields: {
definition: {
type: new GraphQLObjectType({
name: 'definition',
fields: {
rules: {
type: new GraphQLList(
new GraphQLObjectType({
name: 'rules',
field: {
field: { type: GraphQLString },
value: { type: GraphQLString },
operator: { type: GraphQLString }
}
})
)
}
}
})
},
page: { type: GraphQLInt },
page_size: { type: GraphQLInt }
}
})
}
})
});
Sheel Patel
09/23/2017, 3:50 AMcodegeek001
09/23/2017, 3:51 AMcodegeek001
09/23/2017, 3:52 AM...
search: {
type: SearchType,
args: {
search: { type: SearchType},
resolve(parentValue, args) {
return args.search;
}
}
}
codegeek001
09/23/2017, 3:53 AMcodegeek001
09/23/2017, 3:53 AMroot.search(search:) argument type must be Input Type but got: search.
Sheel Patel
09/23/2017, 3:54 AMGraphQLInputObjectType
instead of GraphQLObjectType
for argumentscodegeek001
09/23/2017, 3:57 AMsearch
that needs to be a InputObjectType instead of the SearchType?Sheel Patel
09/23/2017, 4:00 AMSheel Patel
09/23/2017, 4:01 AMSheel Patel
09/23/2017, 4:03 AMcodegeek001
09/23/2017, 4:05 AMcodegeek001
09/23/2017, 4:15 AMsearch: {
type: GraphQLString,
args: {
search: { type: SearchInput },
resolve(parentValue, args) {
return args.search.type;
}
}
}
Then the Input its grabbing looks like this
const SearchInput = new GraphQLInputObjectType({
name: 'search',
fields: {
type: { type: new GraphQLNonNull(GraphQLString) }
}
});
But I still get this error
root.search(resolve:) argument type must be Input Type but got: undefined.
codegeek001
09/23/2017, 4:15 AMcodegeek001
09/23/2017, 4:16 AMSheel Patel
09/23/2017, 4:16 AMcodegeek001
09/23/2017, 4:16 AMSheel Patel
09/23/2017, 4:17 AM