Skip to content

Commit

Permalink
adjust schema for fields created by setFieldsOnGraphQLNodeType
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh committed Jul 10, 2018
1 parent 1fd7509 commit 3e0839d
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,21 @@ function convertToInputFilter(
const innerFilter = convertToInputFilter(`${prefix}ListElem`, innerType)
const innerFields = innerFilter ? innerFilter.getFields() : {}

return new GraphQLInputObjectType({
name: createTypeName(`${prefix}QueryList`),
fields: {
let fields
if (innerType instanceof GraphQLInputObjectType) {
fields = {
elemMatch: { type: innerFilter },
}
} else {
fields = {
...innerFields,
in: { type: new GraphQLList(innerType) },
},
}
}

return new GraphQLInputObjectType({
name: createTypeName(`${prefix}QueryList`),
fields,
})
} else if (type instanceof GraphQLNonNull) {
return convertToInputFilter(prefix, type.ofType)
Expand Down

0 comments on commit 3e0839d

Please sign in to comment.