Make every field in InputType nullable #852
-
Is it possible to make every field in an Example: I have a @ObjectType()
@InputType()
class User {
@Field()
username: string;
@Field({ nullable: true })
optionalField?: string;
}
@InputType()
class CreateUserInput extends User {
@Field()
@MinLength(8) // validation, ...
password: string;
}
// i want this - but I don't want to type this
@InputType()
class MutateUser {
@Field({ nullable: true })
username: string;
@Field({ nullable: true })
optionalField?: string;
@Field({ nullable: true })
@MinLength(3)
password: string;
} |
Beta Was this translation helpful? Give feedback.
Answered by
MichalLytek
Apr 9, 2021
Replies: 1 comment 2 replies
-
Nope, there's no built-in way for doing that. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
korki43
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nope, there's no built-in way for doing that.