Skip to content

Commit

Permalink
fix(gatsby): Make root plural fields non nullable (#15321)
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia authored and sidharthachatterjee committed Aug 9, 2019
1 parent b00962d commit 2c79309
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packages/gatsby-source-graphql/src/transforms.js
@@ -1,4 +1,8 @@
const { GraphQLObjectType, GraphQLSchema } = require(`gatsby/graphql`)
const {
GraphQLObjectType,
GraphQLNonNull,
GraphQLSchema,
} = require(`gatsby/graphql`)
const {
visitSchema,
VisitSchemaKind,
Expand Down Expand Up @@ -37,7 +41,7 @@ class NamespaceUnderFieldTransform {
name: query.name,
fields: {
[this.fieldName]: {
type: nestedType,
type: new GraphQLNonNull(nestedType),
resolve: (parent, args, context, info) => {
if (this.resolver) {
return this.resolver(parent, args, context, info)
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/schema/schema.js
Expand Up @@ -931,7 +931,7 @@ const addTypeToRootQuery = ({ schemaComposer, typeComposer }) => {
},
resolve: findManyPaginated(typeName),
},
})
}).makeFieldNonNull([queryNamePlural])
}

const parseTypes = ({
Expand Down

0 comments on commit 2c79309

Please sign in to comment.