@graphql-codegen/core 6.0.1 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/codegen.js CHANGED
@@ -28,8 +28,14 @@ async function codegen(options) {
28
28
  }
29
29
  }
30
30
  const federationInConfig = (0, utils_js_1.pickFlag)('federation', options.config);
31
+ /**
32
+ * @description When set to `true`, it disables the automatic injection of legacy Federation v1 directives and scalars (such as `@key`, `@external`, and `_FieldSet`).
33
+ */
34
+ const disableFederationDirectiveAndScalarInjection = (0, utils_js_1.pickFlag)('disableFederationDirectiveAndScalarInjection', options.config);
31
35
  const isFederation = (0, utils_js_1.prioritize)(federationInConfig, false);
32
- if (isFederation && !(0, utils_js_1.hasFederationSpec)(options.schemaAst || options.schema)) {
36
+ if (isFederation &&
37
+ !disableFederationDirectiveAndScalarInjection &&
38
+ !(0, utils_js_1.hasFederationSpec)(options.schemaAst || options.schema)) {
33
39
  additionalTypeDefs.push(plugin_helpers_1.federationSpec);
34
40
  }
35
41
  // Use mergeSchemas, only if there is no GraphQLSchema provided or the schema should be extended
package/esm/codegen.js CHANGED
@@ -24,8 +24,14 @@ export async function codegen(options) {
24
24
  }
25
25
  }
26
26
  const federationInConfig = pickFlag('federation', options.config);
27
+ /**
28
+ * @description When set to `true`, it disables the automatic injection of legacy Federation v1 directives and scalars (such as `@key`, `@external`, and `_FieldSet`).
29
+ */
30
+ const disableFederationDirectiveAndScalarInjection = pickFlag('disableFederationDirectiveAndScalarInjection', options.config);
27
31
  const isFederation = prioritize(federationInConfig, false);
28
- if (isFederation && !hasFederationSpec(options.schemaAst || options.schema)) {
32
+ if (isFederation &&
33
+ !disableFederationDirectiveAndScalarInjection &&
34
+ !hasFederationSpec(options.schemaAst || options.schema)) {
29
35
  additionalTypeDefs.push(federationSpec);
30
36
  }
31
37
  // Use mergeSchemas, only if there is no GraphQLSchema provided or the schema should be extended
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/core",
3
- "version": "6.0.1",
3
+ "version": "6.1.0",
4
4
  "peerDependencies": {
5
5
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
6
6
  },