#WHY IS "fix: owned types are marked as extension when GraphQL v16 is used #1539" CLOSED?

9 messages · Page 1 of 1 (latest)

vagrant needle
vagrant needle
quick moth
#

Do you have a User object type defined?

vagrant needle
#
@ObjectType()
@Directive('@key(fields: "id")') // this line breaks the gateway
export class User {
  @Field((type) => ID)
  id: number

  @Field()
  name: string

  @Field()
  email: string
}
#

@quick moth ⬆️ the error is caused when I add @Directive('@key(fields: "id")') // this line breaks the gateway to the User object type. (see the SO question)

This is the original unresolved (and closed 🙃) issue:

https://github.com/nestjs/graphql/issues/2029

vagrant needle
#

What am I missing?

vagrant needle
#

I decided to patch this file and call it a day. The bug is likely caused by @Directive('@key(fields: "id")') directive - either the decorator is problematic or the underlying tech.

`--- node_modules/@apollo/federation-internals/dist/schemaUpgrader.js.bak    2024-06-03 14:05:31
+++ node_modules/@apollo/federation-internals/dist/schemaUpgrader.js    2024-06-03 14:05:54
@@ -286,7 +286,7 @@
                 return;
             }
         }
-        this.addError(error_1.ERRORS.EXTENSION_WITH_NO_BASE.err(`Type "${type}" is an extension type, but there is no type definition for "${type}" in any subgraph.`, { nodes: extensionAST }));
+        // this.addError(error_1.ERRORS.EXTENSION_WITH_NO_BASE.err(`Type "${type}" is an extension type, but there is no type definition for "${type}" in any subgraph.`, { nodes: extensionAST }));
     }
     preUpgradeValidations() {
         for (const type of this.schema.types()) {
`