Is there an existing issue for this?
Current behavior
Having a base @ObjectType({ isAbstract: true }) class decorated with @Directive('@key(fields: "id")') does not apply that directive to inherited classes.
Minimum reproduction code
N/A
Steps to reproduce
- Copy sample 31 for code-first federation.
- Add a
model.base.ts to users-application/src/users/models:
@ObjectType({
isAbstract: true,
})
@Directive('@key(fields: "id")')
export class ModelBase {
@Field((type) => ID)
id: number;
}
- Update the
user.model.ts:
@ObjectType()
export class User extends ModelBase {
@Field()
name: string;
}
- Start the projects (gateway last)
- See the error in the gateway console
Expected behavior
The directive is applied to all inheriting classes.
Package version
12.0.8
Graphql version
"@apollo/gateway": "2.2.3",
"@apollo/server": "4.7.5",
"@nestjs/apollo": "12.0.3",
"@nestjs/graphql": "12.0.3",
"graphql": "16.6.0",
"graphql-tools": "9.0.0",
NestJS version
^10.0.3
Node.js version
18.17.0
In which operating systems have you tested?
Other
- Tried with both federation 1 and 2.
- I presume this is an issue not specifically related to federation, but I do not know enough about directives to test other configurations for now.
- I have tested this with the (currently) latest versions in my own project with the same results:
"@apollo/server": "^4.9.1",
"@nestjs/apollo": "^12.0.7",
"@nestjs/graphql": "^12.0.8",
"graphql": "^16.7.1",
Is there an existing issue for this?
Current behavior
Having a base
@ObjectType({ isAbstract: true })class decorated with@Directive('@key(fields: "id")')does not apply that directive to inherited classes.Minimum reproduction code
N/A
Steps to reproduce
model.base.tstousers-application/src/users/models:user.model.ts:Expected behavior
The directive is applied to all inheriting classes.
Package version
12.0.8
Graphql version
NestJS version
^10.0.3
Node.js version
18.17.0
In which operating systems have you tested?
Other