Closed aspitrine closed 2 years ago
@aspitrine This has been resolved in the newly released v0.1.27
. The only consideration to be made here is that the GraphQL operations must have different names.
/nuxt-app/queries/client1/settings.gql
query MainSettings {
settings {
...
}
}
/nuxt-app/queries/client2/settings.gql
query OtherSettings {
settings { # directus_settings
...
}
}
Hi, I have an error when i use multiple client who have the same field but with different type
Unable to merge GraphQL type "Query": Field "settings" already defined with a different type. Declared as "directus_settings", but you tried to override with "settings"
I have in my first client schema
and in the other client schema
It's during the
Generate to gql-sdk.ts
phase.See the full error
``` Generate to gql-sdk.ts ✖ Failed to load schema from /Users/quentinlogie/dev/eliakim/app/src/schema.gql,/Users/quentinlogie/dev/eliakim/app/src/schema-system.gql: Unable to merge GraphQL type "Query": Field "settings" already defined with a different type. Declared as "directus_settings", but you tried to override with "settings" Error: Unable to merge GraphQL type "Query": Field "settings" already defined with a different type. Declared as "directus_settings", but you tried to override with "settings" at mergeType (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/merge/esm/typedefs-mergers/type.js:23:19) at mergeGraphQLNodes (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-nodes.js:34:49) at mergeGraphQLTypes (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-typedefs.js:63:25) at mergeTypeDefs (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-typedefs.js:10:22) at makeExecutableSchema (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/schema/esm/makeExecutableSchema.js:69:32) at mergeSchemas (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/schema/esm/merge-schemas.js:29:12) at getSchemaFromSources (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/load/esm/schema.js:51:20) at loadSchema (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/load/esm/schema.js:16:12) at async loadSchema (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-codegen/cli/esm/load.js:33:24) at async file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-codegen/cli/esm/codegen.js:189:69 GraphQL Code Generator supports: - ES Modules and CommonJS exports (export as default or named export "schema") - Introspection JSON File - URL of GraphQL endpoint - Multiple files with type definitions (glob expression) - String in config file Try to use one of above options and run codegen again. ◼ Load GraphQL documents ◼ Generate ERROR 09:51:17 Failed to load schema from /Users/quentinlogie/dev/eliakim/app/src/schema.gql,/Users/quentinlogie/dev/eliakim/app/src/schema-system.gql: Unable to merge GraphQL type "Query": Field "settings" already defined with a different type. Declared as "directus_settings", but you tried to override with "settings" Error: Unable to merge GraphQL type "Query": Field "settings" already defined with a different type. Declared as "directus_settings", but you tried to override with "settings" at mergeType (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/merge/esm/typedefs-mergers/type.js:23:19) at mergeGraphQLNodes (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-nodes.js:34:49) at mergeGraphQLTypes (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-typedefs.js:63:25) at mergeTypeDefs (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-typedefs.js:10:22) at makeExecutableSchema (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/schema/esm/makeExecutableSchema.js:69:32) at mergeSchemas (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/schema/esm/merge-schemas.js:29:12) at getSchemaFromSources (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/load/esm/schema.js:51:20) at loadSchema (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-tools/load/esm/schema.js:16:12) at async loadSchema (file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-codegen/cli/esm/load.js:33:24) at async file:///Users/quentinlogie/dev/eliakim/app/src/node_modules/@graphql-codegen/cli/esm/codegen.js:189:69 GraphQL Code Generator supports: - ES Modules and CommonJS exports (export as default or named export "schema") - Introspection JSON File - URL of GraphQL endpoint - Multiple files with type definitions (glob expression) - String in config file Try to use one of above options and run codegen again. Failed to load schema from schema.gql,/Users/quentinlogie/dev/eliakim/app/src/schema-system.gql: Unable to merge GraphQL type "Query": Field "settings" already defined with a different type. Declared as "directus_settings", but you tried to override with "settings" Error: Unable to merge GraphQL type "Query": Field "settings" already defined with a different type. Declared as "directus_settings", but you tried to override with "settings" at mergeType (node_modules/@graphql-tools/merge/esm/typedefs-mergers/type.js:23:19) at mergeGraphQLNodes (node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-nodes.js:34:49) at mergeGraphQLTypes (node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-typedefs.js:63:25) at mergeTypeDefs (node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-typedefs.js:10:22) at makeExecutableSchema (node_modules/@graphql-tools/schema/esm/makeExecutableSchema.js:69:32) at mergeSchemas (node_modules/@graphql-tools/schema/esm/merge-schemas.js:29:12) at getSchemaFromSources (node_modules/@graphql-tools/load/esm/schema.js:51:20) at loadSchema (node_modules/@graphql-tools/load/esm/schema.js:16:12) at async loadSchema (node_modules/@graphql-codegen/cli/esm/load.js:33:24) at async node_modules/@graphql-codegen/cli/esm/codegen.js:189:69 GraphQL Code Generator supports: - ES Modules and CommonJS exports (export as default or named export "schema") - Introspection JSON File - URL of GraphQL endpoint - Multiple files with type definitions (glob expression) - String in config file Try to use one of above options and run codegen again. at new AggregateErrorImpl (node_modules/@graphql-tools/utils/esm/AggregateError.js:12:16) at executeCodegen (node_modules/@graphql-codegen/cli/esm/codegen.js:320:24) at async generate (node_modules/@graphql-codegen/cli/esm/generate-and-save.js:87:25) at async generate (node_modules/nuxt-graphql-client/dist/module.mjs:60:10) at async generateGqlTypes (node_modules/nuxt-graphql-client/dist/module.mjs:274:22) at async setup (node_modules/nuxt-graphql-client/dist/module.mjs:328:5) at async Object.normalizedModule (node_modules/@nuxt/kit/dist/index.mjs:630:5) at async installModule (node_modules/@nuxt/kit/dist/index.mjs:449:3) at async initNuxt (node_modules/nuxt/dist/index.mjs:1599:7) at async loadNuxt (node_modules/nuxt/dist/index.mjs:1628:5) Error: Failed to load schema from schema.gql,/Users/quentinlogie/dev/eliakim/app/src/schema-system.gql: Unable to merge GraphQL type "Query": Field "settings" already defined with a different type. Declared as "directus_settings", but you tried to override with "settings" Error: Unable to merge GraphQL type "Query": Field "settings" already defined with a different type. Declared as "directus_settings", but you tried to override with "settings" at mergeType (node_modules/@graphql-tools/merge/esm/typedefs-mergers/type.js:23:19) at mergeGraphQLNodes (node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-nodes.js:34:49) at mergeGraphQLTypes (node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-typedefs.js:63:25) at mergeTypeDefs (node_modules/@graphql-tools/merge/esm/typedefs-mergers/merge-typedefs.js:10:22) at makeExecutableSchema (node_modules/@graphql-tools/schema/esm/makeExecutableSchema.js:69:32) at mergeSchemas (node_modules/@graphql-tools/schema/esm/merge-schemas.js:29:12) at getSchemaFromSources (node_modules/@graphql-tools/load/esm/schema.js:51:20) at loadSchema (node_modules/@graphql-tools/load/esm/schema.js:16:12) at async loadSchema (node_modules/@graphql-codegen/cli/esm/load.js:33:24) at async node_modules/@graphql-codegen/cli/esm/codegen.js:189:69 GraphQL Code Generator supports: - ES Modules and CommonJS exports (export as default or named export "schema") - Introspection JSON File - URL of GraphQL endpoint - Multiple files with type definitions (glob expression) - String in config file Try to use one of above options and run codegen again. at loadSchema (node_modules/@graphql-codegen/cli/esm/load.js:42:15) at async node_modules/@graphql-codegen/cli/esm/codegen.js:189:69 at async node_modules/@graphql-codegen/cli/esm/codegen.js:188:56 at async node_modules/@graphql-codegen/cli/esm/codegen.js:63:21 at async Task.run (node_modules/listr2/dist/index.js:960:11) at async node_modules/p-map/index.js:57:22 error Command failed with exit code 1 ```Thanks for your work