-
-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Description
Input objects support default values and we'd like to get this supported in the generated schema: http://spec.graphql.org/June2018/#sec-Input-Objects
enum PageType {
PUBLIC
BASIC_AUTH
}
input PageInput {
pageType: PageType! = PUBLIC
greeting: String = "Hello"
score: Int = 100
ratio: Float = 0.5
isMember: Boolean = true
}
Should be able to generate the following:
export const PageTypeSchema = z.nativeEnum(PageType);
export function PageInputSchema(): z.ZodObject<Properties<PageInput>> {
return z.object({
pageType: PageTypeSchema.default("PUBLIC"),
greeting: z.string().default("Hello").nullish(),
score: z.number().default(100).nullish(),
ratio: z.number().default(0.5).nullish(),
isMember: z.boolean().default(true).nullish()
})
}
AndKiel
Metadata
Metadata
Assignees
Labels
No labels