From e7aded5020a11e44be10a3a003f3e479586eb590 Mon Sep 17 00:00:00 2001 From: Sylvain Lebresne Date: Thu, 14 Jul 2022 15:49:03 +0200 Subject: [PATCH] Changelog + proper version in error doc code --- docs/source/errors.md | 6 +++--- gateway-js/CHANGELOG.md | 4 ++++ internals-js/src/error.ts | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/source/errors.md b/docs/source/errors.md index 7faf2a05c..90bba9702 100644 --- a/docs/source/errors.md +++ b/docs/source/errors.md @@ -49,7 +49,7 @@ The following errors might be raised during composition: | `INVALID_LINK_DIRECTIVE_USAGE` | An application of the @link directive is invalid/does not respect the specification. | 2.0.0 | | | `INVALID_LINK_IDENTIFIER` | A url/version for a @link feature is invalid/does not respect the specification. | 2.1.0 | | | `INVALID_SUBGRAPH_NAME` | A subgraph name is invalid (subgraph names cannot be a single underscore ("_")). | 2.0.0 | | -| `KEY_DIRECTIVE_IN_FIELDS_ARG` | The `fields` argument of a `@key` directive includes some directive applications. This is not supported | 2.0.0 | | +| `KEY_DIRECTIVE_IN_FIELDS_ARG` | The `fields` argument of a `@key` directive includes some directive applications. This is not supported | 2.1.0 | | | `KEY_FIELDS_HAS_ARGS` | The `fields` argument of a `@key` directive includes a field defined with arguments (which is not currently supported). | 2.0.0 | | | `KEY_FIELDS_SELECT_INVALID_TYPE` | The `fields` argument of `@key` directive includes a field whose type is a list, interface, or union type. Fields of these types cannot be part of a `@key` | 0.x | | | `KEY_INVALID_FIELDS_TYPE` | The value passed to the `fields` argument of a `@key` directive is not a string. | 2.0.0 | | @@ -62,7 +62,7 @@ The following errors might be raised during composition: | `OVERRIDE_COLLISION_WITH_ANOTHER_DIRECTIVE` | The @override directive cannot be used on external fields, nor to override fields with either @external, @provides, or @requires. | 2.0.0 | | | `OVERRIDE_FROM_SELF_ERROR` | Field with `@override` directive has "from" location that references its own subgraph. | 2.0.0 | | | `OVERRIDE_SOURCE_HAS_OVERRIDE` | Field which is overridden to another subgraph is also marked @override. | 2.0.0 | | -| `PROVIDES_DIRECTIVE_IN_FIELDS_ARG` | The `fields` argument of a `@provides` directive includes some directive applications. This is not supported | 2.0.0 | | +| `PROVIDES_DIRECTIVE_IN_FIELDS_ARG` | The `fields` argument of a `@provides` directive includes some directive applications. This is not supported | 2.1.0 | | | `PROVIDES_FIELDS_HAS_ARGS` | The `fields` argument of a `@provides` directive includes a field defined with arguments (which is not currently supported). | 2.0.0 | | | `PROVIDES_FIELDS_MISSING_EXTERNAL` | The `fields` argument of a `@provides` directive includes a field that is not marked as `@external`. | 0.x | | | `PROVIDES_INVALID_FIELDS_TYPE` | The value passed to the `fields` argument of a `@provides` directive is not a string. | 2.0.0 | | @@ -74,7 +74,7 @@ The following errors might be raised during composition: | `REQUIRED_ARGUMENT_MISSING_IN_SOME_SUBGRAPH` | An argument of a field or directive definition is mandatory in some subgraphs, but the argument is not defined in all the subgraphs that define the field or directive definition. | 2.0.0 | | | `REQUIRED_INACCESSIBLE` | An element is marked as @inaccessible but is required by an element visible in the API schema. | 2.0.0 | | | `REQUIRED_INPUT_FIELD_MISSING_IN_SOME_SUBGRAPH` | A field of an input object type is mandatory in some subgraphs, but the field is not defined in all the subgraphs that define the input object type. | 2.0.0 | | -| `REQUIRES_DIRECTIVE_IN_FIELDS_ARG` | The `fields` argument of a `@requires` directive includes some directive applications. This is not supported | 2.0.0 | | +| `REQUIRES_DIRECTIVE_IN_FIELDS_ARG` | The `fields` argument of a `@requires` directive includes some directive applications. This is not supported | 2.1.0 | | | `REQUIRES_FIELDS_HAS_ARGS` | The `fields` argument of a `@requires` directive includes a field defined with arguments (which is not currently supported). | 2.0.0 | | | `REQUIRES_FIELDS_MISSING_EXTERNAL` | The `fields` argument of a `@requires` directive includes a field that is not marked as `@external`. | 0.x | | | `REQUIRES_INVALID_FIELDS_TYPE` | The value passed to the `fields` argument of a `@requires` directive is not a string. | 2.0.0 | | diff --git a/gateway-js/CHANGELOG.md b/gateway-js/CHANGELOG.md index 3c5cd4a4c..3b7d5965f 100644 --- a/gateway-js/CHANGELOG.md +++ b/gateway-js/CHANGELOG.md @@ -11,6 +11,10 @@ This CHANGELOG pertains only to Apollo Federation packages in the 2.x range. The - Cleanup error related code, adding missing error code to a few errors [PR #1914](https://github.com/apollographql/federation/pull/1914). - Fix issue generating plan for a "diamond-shaped" dependency [PR #1900](https://github.com/apollographql/federation/pull/1900). - Fix issue computing query plan costs that can lead to extra unnecessary fetches [PR #1937](https://github.com/apollographql/federation/pull/1937). +- Reject directive applications within `fields` of `@key`, `@provides` and `@requires`[PR #1975](https://github.com/apollographql/federation/pull/1975). + - __BREAKING__: previously, directive applications within a `@key`, `@provides` or `@requires` were parsed but + not honored in any way. As this change reject such applications (at composition time), it could theoretically + require to remove some existing (ignored) directive applications within a `@key`, `@provides` or `@requires`. ## 2.1.0-alpha.0 diff --git a/internals-js/src/error.ts b/internals-js/src/error.ts index 162ff776d..018888f7d 100644 --- a/internals-js/src/error.ts +++ b/internals-js/src/error.ts @@ -185,6 +185,7 @@ const REQUIRES_UNSUPPORTED_ON_INTERFACE = DIRECTIVE_UNSUPPORTED_ON_INTERFACE.cre const DIRECTIVE_IN_FIELDS_ARG = makeFederationDirectiveErrorCodeCategory( 'DIRECTIVE_IN_FIELDS_ARG', (directive) => `The \`fields\` argument of a \`@${directive}\` directive includes some directive applications. This is not supported`, + { addedIn: '2.1.0' }, ); const KEY_HAS_DIRECTIVE_IN_FIELDS_ARGS = DIRECTIVE_IN_FIELDS_ARG.createCode('key');