'Error: Cannot determine a GraphQL input type ("TypeService") for the "servicesType". Make sure your class is decorated with an appropriate decorator
import { ObjectType, Field, Int, ID } from '@nestjs/graphql';
import { TypeService } from 'src/type-services/entities/type-service.entity';
@ObjectType()
export class Schedule {
@Field(() => ID)
id?: string;
@Field(() => Date)
date: string | Date;
@Field(() => String)
userID: string;
@Field(() => [TypeService])
servicesType?: TypeService[];
}
import { InputType, Int, Field, ID } from '@nestjs/graphql';
import { TypeService } from 'src/type-services/entities/type-service.entity';
@InputType()
export class CreateScheduleInput {
@Field(() => String)
userID: string | null;
@Field()
date: Date;
@Field(() => [TypeService])
servicesType?: TypeService[];
}
Error: Cannot determine a GraphQL input type ("TypeService") for the "servicesType". Make sure your class is decorated with an appropriate decorator.
Solution 1:[1]
I am assuming that TypeService
is either annotated with @ObjectType()
or not annotated at all as it is the most likely reason for the error.
The issue is that you are using a non-InputType (TypeService
) as a property of an InputType (CreateScheduleInput
), and nested fields of an InputType must be InputTypes as well.
The solution would be to define an InputType for the TypeService
(such as CreateTypeServiceInput
) which would be annotated with @InputType()
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Houssam |