@@ -690,8 +690,14 @@ describe('SchemaGenerator', () => {
690690 } )
691691 const generator = new SchemaGenerator ( spec )
692692 const result = generator . generateModels ( )
693- expect ( result ) . toContain ( 'export const UserProfile =' )
694- expect ( result ) . toContain ( 'export type UserProfileModel =' )
693+ expect ( result ) . toContain (
694+ 'export const UserProfile: z.ZodType<UserProfileModel> = z.object({'
695+ )
696+ expect ( result ) . toContain ( "'name': z.string().optional()" )
697+ expect ( result ) . toContain ( '});' )
698+ expect ( result ) . toContain (
699+ "export type UserProfileModel = {\n 'name'?: string | undefined;\n};"
700+ )
695701 } )
696702
697703 it ( 'should generate imports and exports' , ( ) => {
@@ -701,10 +707,10 @@ describe('SchemaGenerator', () => {
701707 const generator = new SchemaGenerator ( spec )
702708 const result = generator . generateModels ( )
703709 expect ( result ) . toContain ( "import { z } from 'zod';" )
704- expect ( result ) . toContain ( 'export const User = z.string();' )
705710 expect ( result ) . toContain (
706- 'export type UserModel = z.infer<typeof User> ;'
711+ 'export const User: z.ZodType< UserModel> = z.string() ;'
707712 )
713+ expect ( result ) . toContain ( 'export type UserModel = string;' )
708714 } )
709715
710716 it ( 'should handle multiple schemas' , ( ) => {
@@ -854,7 +860,7 @@ describe('SchemaGenerator', () => {
854860 const models = generator . generateModels ( )
855861
856862 expect ( models ) . toContain (
857- "export const UnionHell = z.discriminatedUnion('type', [OptionA, OptionB]);"
863+ "export const UnionHell: z.ZodType<UnionHellModel> = z.discriminatedUnion('type', [OptionA, OptionB]);"
858864 )
859865 } )
860866
0 commit comments