diff --git a/examples/getstarted/api/homepage/config/schema.graphql.js b/examples/getstarted/api/homepage/config/schema.graphql.js deleted file mode 100644 index 5f82ca4b67..0000000000 --- a/examples/getstarted/api/homepage/config/schema.graphql.js +++ /dev/null @@ -1,38 +0,0 @@ -module.exports = { - query: ` - - customQuery: String - customQuery2: String - restaurantByAddress: Homepage - q1: Homepage - - `, - resolver: { - Query: { - customQuery: { - policies: [], // consider that the local policies are in the api which is created this file - resolverOf: 'application::restaurant.restaurant.find', - resolver() {}, - }, - customQuery2: { - policies: [], // consider that the local policies are in the api which is created this file - resolver: 'application::restaurant.restaurant.find', - }, - restaurantByAddress: { - policies: [], // consider that the local policies are in the api which is created this file - resolverOf: 'application::address.address.find', - resolver: 'application::homepage.homepage.find', - }, - q1: { - policies: ['test'], - resolverOf: 'application::restaurant.restaurant.find', - resolver(root, args, ctx) { - return { - id: 1, - title: 'coucou', - }; - }, - }, - }, - }, -}; diff --git a/packages/strapi-plugin-graphql/services/Schema.js b/packages/strapi-plugin-graphql/services/Schema.js index 78eb77dacb..01ff5c4c3a 100644 --- a/packages/strapi-plugin-graphql/services/Schema.js +++ b/packages/strapi-plugin-graphql/services/Schema.js @@ -160,19 +160,13 @@ const generateSchema = () => { return {}; } - const queryFields = formatGQL( - shadowCRUD.query, - resolver.Query, - null, - 'query' - ); + const queryFields = + shadowCRUD.query && + formatGQL(shadowCRUD.query, resolver.Query, null, 'query'); - const mutationFields = formatGQL( - shadowCRUD.mutation, - resolver.Mutation, - null, - 'mutation' - ); + const mutationFields = + shadowCRUD.mutation && + formatGQL(shadowCRUD.mutation, resolver.Mutation, null, 'mutation'); const scalars = Types.getScalars();