Skip to content

Commit 36a4d5e

Browse files
committed
regenerated example schema
1 parent 350deb9 commit 36a4d5e

File tree

7 files changed

+50
-6
lines changed

7 files changed

+50
-6
lines changed

example/myzod/schemas.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as myzod from 'myzod'
2-
import { Admin, AttributeInput, ButtonComponentType, ComponentInput, DropDownComponentInput, EventArgumentInput, EventInput, EventOptionType, Guest, HttpInput, HttpMethod, LayoutInput, MyType, MyTypeFooArgs, Namer, PageInput, PageType, User } from '../types'
2+
import { Admin, AttributeInput, ButtonComponentType, Comment, ComponentInput, DropDownComponentInput, EventArgumentInput, EventInput, EventOptionType, Guest, HttpInput, HttpMethod, LayoutInput, MyType, MyTypeFooArgs, Namer, PageInput, PageType, User } from '../types'
33

44
export const definedNonNullAnySchema = myzod.object({});
55

@@ -25,6 +25,13 @@ export function AttributeInputSchema(): myzod.Type<AttributeInput> {
2525
})
2626
}
2727

28+
export function CommentSchema(): myzod.Type<Comment> {
29+
return myzod.object({
30+
__typename: myzod.literal('Comment').optional(),
31+
replies: myzod.array(myzod.lazy(() => CommentSchema())).optional().nullable()
32+
})
33+
}
34+
2835
export function ComponentInputSchema(): myzod.Type<ComponentInput> {
2936
return myzod.object({
3037
child: myzod.lazy(() => ComponentInputSchema().optional().nullable()),

example/test.graphql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,7 @@ directive @constraint(
121121
multipleOf: Float
122122
uniqueTypeName: String
123123
) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION
124+
125+
type Comment {
126+
replies: [Comment!]
127+
}

example/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ export enum ButtonComponentType {
3131
Submit = 'SUBMIT'
3232
}
3333

34+
export type Comment = {
35+
__typename?: 'Comment';
36+
replies?: Maybe<Array<Comment>>;
37+
};
38+
3439
export type ComponentInput = {
3540
child?: InputMaybe<ComponentInput>;
3641
childrens?: InputMaybe<Array<InputMaybe<ComponentInput>>>;

example/valibot/schemas.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as v from 'valibot'
2-
import { Admin, AttributeInput, ButtonComponentType, ComponentInput, DropDownComponentInput, EventArgumentInput, EventInput, EventOptionType, Guest, HttpInput, HttpMethod, LayoutInput, MyType, MyTypeFooArgs, Namer, PageInput, PageType, User } from '../types'
2+
import { Admin, AttributeInput, ButtonComponentType, Comment, ComponentInput, DropDownComponentInput, EventArgumentInput, EventInput, EventOptionType, Guest, HttpInput, HttpMethod, LayoutInput, MyType, MyTypeFooArgs, Namer, PageInput, PageType, User } from '../types'
33

44
export const ButtonComponentTypeSchema = v.enum_(ButtonComponentType);
55

@@ -23,6 +23,13 @@ export function AttributeInputSchema(): v.GenericSchema<AttributeInput> {
2323
})
2424
}
2525

26+
export function CommentSchema(): v.GenericSchema<Comment> {
27+
return v.object({
28+
__typename: v.optional(v.literal('Comment')),
29+
replies: v.nullish(v.array(v.lazy(() => CommentSchema())))
30+
})
31+
}
32+
2633
export function ComponentInputSchema(): v.GenericSchema<ComponentInput> {
2734
return v.object({
2835
child: v.lazy(() => v.nullish(ComponentInputSchema())),

example/yup/schemas.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as yup from 'yup'
2-
import { Admin, AttributeInput, ButtonComponentType, ComponentInput, DropDownComponentInput, EventArgumentInput, EventInput, EventOptionType, Guest, HttpInput, HttpMethod, LayoutInput, MyType, MyTypeFooArgs, Namer, PageInput, PageType, User, UserKind } from '../types'
2+
import { Admin, AttributeInput, ButtonComponentType, Comment, ComponentInput, DropDownComponentInput, EventArgumentInput, EventInput, EventOptionType, Guest, HttpInput, HttpMethod, LayoutInput, MyType, MyTypeFooArgs, Namer, PageInput, PageType, User, UserKind } from '../types'
33

44
export const ButtonComponentTypeSchema = yup.string<ButtonComponentType>().oneOf(Object.values(ButtonComponentType)).defined();
55

@@ -29,6 +29,13 @@ export function AttributeInputSchema(): yup.ObjectSchema<AttributeInput> {
2929
})
3030
}
3131

32+
export function CommentSchema(): yup.ObjectSchema<Comment> {
33+
return yup.object({
34+
__typename: yup.string<'Comment'>().optional(),
35+
replies: yup.array(yup.lazy(() => CommentSchema().nonNullable())).defined().nullable().optional()
36+
})
37+
}
38+
3239
export function ComponentInputSchema(): yup.ObjectSchema<ComponentInput> {
3340
return yup.object({
3441
child: yup.lazy(() => ComponentInputSchema()).optional(),

example/zod/schemas.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { z } from 'zod/v3'
2-
import { Admin, AttributeInput, ButtonComponentType, ComponentInput, DropDownComponentInput, EventArgumentInput, EventInput, EventOptionType, Guest, HttpInput, HttpMethod, LayoutInput, MyType, MyTypeFooArgs, Namer, PageInput, PageType, User } from '../types'
2+
import { Admin, AttributeInput, ButtonComponentType, Comment, ComponentInput, DropDownComponentInput, EventArgumentInput, EventInput, EventOptionType, Guest, HttpInput, HttpMethod, LayoutInput, MyType, MyTypeFooArgs, Namer, PageInput, PageType, User } from '../types'
33

44
type Properties<T> = Required<{
55
[K in keyof T]: z.ZodType<T[K], any, T[K]>;
@@ -33,6 +33,13 @@ export function AttributeInputSchema(): z.ZodObject<Properties<AttributeInput>>
3333
})
3434
}
3535

36+
export function CommentSchema(): z.ZodObject<Properties<Comment>> {
37+
return z.object({
38+
__typename: z.literal('Comment').optional(),
39+
replies: z.array(z.lazy(() => CommentSchema())).nullish()
40+
})
41+
}
42+
3643
export function ComponentInputSchema(): z.ZodObject<Properties<ComponentInput>> {
3744
return z.object({
3845
child: z.lazy(() => ComponentInputSchema().nullish()),

example/zodv4/schemas.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as z from 'zod'
2-
import { Admin, AttributeInput, ButtonComponentType, ComponentInput, DropDownComponentInput, EventArgumentInput, EventInput, EventOptionType, Guest, HttpInput, HttpMethod, LayoutInput, MyType, MyTypeFooArgs, Namer, PageInput, PageType, User } from '../types'
2+
import { Admin, AttributeInput, ButtonComponentType, Comment, ComponentInput, DropDownComponentInput, EventArgumentInput, EventInput, EventOptionType, Guest, HttpInput, HttpMethod, LayoutInput, MyType, MyTypeFooArgs, Namer, PageInput, PageType, User } from '../types'
33

44
type Properties<T> = Required<{
55
[K in keyof T]: z.ZodType<T[K]>;
@@ -33,6 +33,13 @@ export function AttributeInputSchema(): z.ZodObject<Properties<AttributeInput>>
3333
})
3434
}
3535

36+
export function CommentSchema(): z.ZodObject<Properties<Comment>> {
37+
return z.object({
38+
__typename: z.literal('Comment').optional(),
39+
replies: z.array(z.lazy(() => CommentSchema())).nullish()
40+
})
41+
}
42+
3643
export function ComponentInputSchema(): z.ZodObject<Properties<ComponentInput>> {
3744
return z.object({
3845
child: z.lazy(() => ComponentInputSchema().nullish()),
@@ -128,7 +135,7 @@ export function UserSchema(): z.ZodObject<Properties<User>> {
128135
createdAt: definedNonNullAnySchema.nullish(),
129136
email: z.string().nullish(),
130137
id: z.string().nullish(),
131-
kind: UserKindSchema().nullish(),
138+
kind: z.lazy(() => UserKindSchema().nullish()),
132139
name: z.string().nullish(),
133140
password: z.string().nullish(),
134141
updatedAt: definedNonNullAnySchema.nullish()

0 commit comments

Comments
 (0)