diff --git a/packages/plugins/graphql/server/bootstrap.js b/packages/plugins/graphql/server/bootstrap.js index b3eaa3e027..651db1827a 100644 --- a/packages/plugins/graphql/server/bootstrap.js +++ b/packages/plugins/graphql/server/bootstrap.js @@ -32,7 +32,10 @@ module.exports = async strapi => { // Initialize loaders for this request. context: ({ ctx }) => { // TODO: set loaders in the context not globally - strapi.plugins.graphql.services.old['data-loaders'].initializeLoader(); + strapi + .plugin('graphql') + .service('old') + ['data-loaders'].initializeLoader(); return { context: ctx, @@ -80,8 +83,6 @@ module.exports = async strapi => { path: config.endpoint, }); - console.log(config.endpoint); - // Register destroy behavior strapi.plugins.graphql.destroy = async () => { await server.stop(); diff --git a/packages/plugins/graphql/server/services/schema/builders/type.js b/packages/plugins/graphql/server/services/schema/builders/type.js index 385bcbf80e..8bfd251365 100644 --- a/packages/plugins/graphql/server/services/schema/builders/type.js +++ b/packages/plugins/graphql/server/services/schema/builders/type.js @@ -211,7 +211,7 @@ const addMediaAttribute = options => { context: { strapi }, } = options; - const fileContentType = strapi.plugin('upload').contentType('file'); + const fileContentType = strapi.plugin('upload').contentType('file').schema; const resolve = buildAssociationResolver({ contentTypeUID: contentType.uid, diff --git a/packages/plugins/graphql/server/services/types/utils.js b/packages/plugins/graphql/server/services/types/utils.js index 86b3461641..99162a7be8 100644 --- a/packages/plugins/graphql/server/services/types/utils.js +++ b/packages/plugins/graphql/server/services/types/utils.js @@ -90,9 +90,9 @@ const getEnumName = (contentType, attributeName) => { const getTypeName = contentType => { const plugin = get('plugin', contentType); const modelName = get('modelName', contentType); - const singularName = get('schema.info.singularName', contentType); + const singularName = get('info.singularName', contentType); - const transformedPlugin = camelCase(plugin); + const transformedPlugin = upperFirst(camelCase(plugin)); const transformedModelName = upperFirst(singularName || toSingular(modelName)); return `${transformedPlugin}${transformedModelName}`; @@ -243,6 +243,7 @@ const getMorphRelationTypeName = (contentType, attributeName) => { * @return {function(*=): string} */ const buildCustomTypeNameGenerator = (options = {}) => { + // todo[v4]: use singularName & pluralName is available const { prefix = '', suffix = '', plurality = 'singular', firstLetterCase = 'upper' } = options; if (!['plural', 'singular'].includes(plurality)) {