2 years later I am still running into the issue. Is there a fix available or should I just give up and keep my sanity and downgrade to GraphQL 15?
#WHY IS "fix: owned types are marked as extension when GraphQL v16 is used #1539" CLOSED?
9 messages · Page 1 of 1 (latest)
If you want points on SO:
https://stackoverflow.com/questions/78568008/owned-types-are-marked-as-extension
Do you have a User object type defined?
@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:
There is a reproduction here: https://github.com/developer239/nest-microservices-example/tree/v2 (yarn install and then run the services)
Using the key directive automatically defines types as extensions #1855
What am I missing?
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()) {
`