diff --git a/gateway-js/CHANGELOG.md b/gateway-js/CHANGELOG.md index 95ab7d51b..aa51d2dfc 100644 --- a/gateway-js/CHANGELOG.md +++ b/gateway-js/CHANGELOG.md @@ -2,7 +2,8 @@ This CHANGELOG pertains only to Apollo Federation packages in the 2.x range. The Federation v0.x equivalent for this package can be found [here](https://github.com/apollographql/federation/blob/version-0.x/gateway-js/CHANGELOG.md) on the `version-0.x` branch of this repo. -- Fix issue generating plan for a "diamond-shaped" dependency [PR #1900](https://github.com/apollographql/federation/pull/1900) +- 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). ## 2.1.0-alpha.0 diff --git a/gateway-js/src/__tests__/integration/configuration.test.ts b/gateway-js/src/__tests__/integration/configuration.test.ts index b63defbf7..5af71bec1 100644 --- a/gateway-js/src/__tests__/integration/configuration.test.ts +++ b/gateway-js/src/__tests__/integration/configuration.test.ts @@ -202,8 +202,8 @@ describe('gateway startup errors', () => { const expected = "A valid schema couldn't be composed. The following composition errors were found:\n" - + ' [accounts] On type "User", for @key(fields: "id"): Cannot query field "id" on type "User" (the field should be either be added to this subgraph or, if it should not be resolved by this subgraph, you need to add it to this subgraph with @external).\n' - + ' [accounts] On type "Account", for @key(fields: "id"): Cannot query field "id" on type "Account" (the field should be either be added to this subgraph or, if it should not be resolved by this subgraph, you need to add it to this subgraph with @external).' + + ' [accounts] On type "User", for @key(fields: "id"): Cannot query field "id" on type "User" (the field should either be added to this subgraph or, if it should not be resolved by this subgraph, you need to add it to this subgraph with @external).\n' + + ' [accounts] On type "Account", for @key(fields: "id"): Cannot query field "id" on type "Account" (the field should either be added to this subgraph or, if it should not be resolved by this subgraph, you need to add it to this subgraph with @external).' expect(err.message).toBe(expected); }); }); diff --git a/internals-js/src/definitions.ts b/internals-js/src/definitions.ts index bc3dc5e36..34879b6f1 100644 --- a/internals-js/src/definitions.ts +++ b/internals-js/src/definitions.ts @@ -65,7 +65,7 @@ export const ErrGraphQLAPISchemaValidationFailed = (causes: GraphQLError[]) => /** * Given an error that may have been thrown during schema validation, extract the causes of validation failure. * If the error is not a graphQL error, undefined is returned. -t*/ + */ export function errorCauses(e: Error): GraphQLError[] | undefined { if (e instanceof GraphQLErrorExt) { if (e.code === validationErrorCode || e.code === apiSchemaValidationErrorCode) { diff --git a/internals-js/src/federation.ts b/internals-js/src/federation.ts index 41f654681..bdffccfa0 100644 --- a/internals-js/src/federation.ts +++ b/internals-js/src/federation.ts @@ -1149,7 +1149,7 @@ export function parseFieldSetArgument({ msg = msg.slice(0, msg.length - 1); } if (directive.name === keyDirectiveSpec.name) { - msg = msg + ' (the field should be either be added to this subgraph or, if it should not be resolved by this subgraph, you need to add it to this subgraph with @external).'; + msg = msg + ' (the field should either be added to this subgraph or, if it should not be resolved by this subgraph, you need to add it to this subgraph with @external).'; } else { msg = msg + ' (if the field is defined in another subgraph, you need to add it to this subgraph with @external).'; }