Closed
Description
When I run the generator, my Yup schema does not add .nullish()
to any optional fields.
my-type.ts
@InputType
export class MyTypeInput {
@Field(() => String)
@IsString()
@IsDefined()
name!: string;
@Field(() => ID, { nullable: true })
@IsString()
@IsOptional()
imageId?: string;
}
schema.graphql
input MyTypeInput {
name: String!
imageId: ID
}
generated-operations.ts
export type MyTypeInput = {
imageId?: InputMaybe<Scalars['ID']>;
name: Scalars['String'];
}
Expected Result
generated-validation-schema.ts
export function MyTypeInputSchema(): yup.SchemaOf<MyTypeInput> {
return yup.object({
imageId: yup.string().nullable(), // <----- this `nullable` is missing in the actual, below
name: yup.string().defined()
})
}
Actual Result
generated-validation-schema.ts
export function MyTypeInputSchema(): yup.SchemaOf<MyTypeInput> {
return yup.object({
imageId: yup.string(),
name: yup.string().defined()
})
}