dotansimha/graphql-code-generator-community
在 GitHub 查看Type-graphql doesn't support a scalar as input argument type
Open
#119 创建于 2021年3月29日
help wanted
仓库指标
- Star
- (136 star)
- PR 合并指标
- (PR 指标待抓取)
描述
Describe the bug When a mutation argument type contains a scalar property the generated code fails to compile. The scalar is wrapped with either a FixFixture<> or Maybe<> with the error message "Cannot find name ''"
To Reproduce
- Create a schema that contains a mutation with with null or non-null argument scalar property (see below)
- Generates the following code for the argument.
@TypeGraphQL.ArgsType() export class MutationRemoveUserArgs {
@TypeGraphQL.Field(type => CustomID) id!: FixDecorator; };
Error message: "Cannot find name 'CustomID"
- My GraphQL schema:
scalar CustomID
interface Node {
id: CustomID!
}
type User implements Node {
id: CustomID!
username: String!
email: String!
}
type Mutation {
removeUser(id: CustomID!): RemoveByIdEmployeePayload
}
type RemoveByIdEmployeePayload {
id: CustomID!
}
- My GraphQL operations:
None
- My
codegen.ymlconfig file:
schema: schema.graphql
config:
scalars:
CustomID: String
generates:
./generatedTypeGraphQL.ts:
plugins:
- typescript-type-graphql
Expected behavior
Expecting the argument class to be:
@TypeGraphQL.ArgsType() export class MutationRemoveUserArgs {
@TypeGraphQL.Field(type => String) id!: FixDecorator<Scalars['CustomID']>; };
Environment:
- OS: Mac OS
@graphql-codegen/...: "@graphql-codegen/cli": "^1.21.3", "@graphql-codegen/typescript-type-graphql": "^1.18.3"- NodeJS:v15.3.0