Сегодня я обновил GraphQL API, созданный с помощью Nest JS, до версии 7.
Я настроил проект для использования нового Nest JS GraphQL Plugin с гнездом -cli с первым подходом кода , однако я получил следующую ошибку при попытке сопоставить один из классов:
(node:67283) UnhandledPromiseRejectionWarning: Error: Cannot determine GraphQL output type for auth
Здесь nest-cli.json
:
{
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"tsConfigPath": "tsconfig.json",
"plugins": [
{
"name": "@nestjs/graphql/plugin",
"options": {
"typeFileNameSuffix": [".model.ts", ".args.ts", ".input.ts"]
}
}
]
}
}
А вот две из моделей: login-success.model.ts
, auth.model.ts
вовлечены в ошибку:
// login-success.model.ts
import { ObjectType } from '@nestjs/graphql';
import { Auth } from './auth.model';
@ObjectType()
export class LoginSuccess {
auth: Auth;
// other stuffs
}
// auth.model.ts
import { Field, Int, ObjectType } from '@nestjs/graphql';
@ObjectType()
export class Auth {
accessToken: string;
@Field(type => Int)
expiresIn: number;
}
У кого-нибудь возникла какая-то проблема? Что-то не так в отображении?