브렌쏭의 Veritas_Garage

Cannot determine a GraphQL input type 본문

[Project_만들다]/[Project_문제해결]

Cannot determine a GraphQL input type

브렌쏭 2022. 4. 10. 12:47
一切皆苦
모든 것은 고통이니 즉, 인생은 고통이다...라고 어느 옛날 왕족 첫째 아들이 그랬던가.

아니.. 내가 한 말이었나.. 그랬나...

현재 내 개발환경은 이렇습니다

  • NestJS 
  • Typescript 
  • GraphQL 
  • TypeORM 
  • MySQL2 

Cannot determine a GraphQL input type

@InputType()
export class CreateCommentInput {
    @Field(() => String)
    content: string;

    @Field(() => Board)
    boardId: string;

    @Field(() => User)
    userId: string;
}

요는 인풋타입으로 들어와야하는 것이 제대로 안들어온다는 것이다. 위에서 userId 를 보면 필드에는 타입이 유저로, 아래에는 문자열 타입이다.

이것들을 한결같게 바꿔줘야한다.

 

@InputType()
export class CreateCommentInput {
    @Field(() => String)
    content: string;

    @Field(() => Board)
    boardId: string;

    @Field(() => String) // 여기를 이렇게 고친다
    userId: string;
}

대문자인 이유는 타입스크립트에서의 문자열 지정은 소문자이지만, GraphQL에서는 앞이 대문자로 시작하기 때문이다.

Comments