@@ -114,7 +114,7 @@ const generateInputObjectFieldTypeZodSchema = (
114114 return maybeLazy ( type . type , gen ) ;
115115 }
116116 if ( isNamedType ( type ) ) {
117- const gen = generateNameNodeZodSchema ( tsVisitor , schema , type . name ) ;
117+ const gen = generateNameNodeZodSchema ( config , tsVisitor , schema , type . name ) ;
118118 if ( isNonNullType ( parentType ) ) {
119119 if ( config . notAllowEmptyString === true ) {
120120 const tsType = tsVisitor . scalars [ type . name . value ] ;
@@ -131,7 +131,12 @@ const generateInputObjectFieldTypeZodSchema = (
131131 return '' ;
132132} ;
133133
134- const generateNameNodeZodSchema = ( tsVisitor : TsVisitor , schema : GraphQLSchema , node : NameNode ) : string => {
134+ const generateNameNodeZodSchema = (
135+ config : ValidationSchemaPluginConfig ,
136+ tsVisitor : TsVisitor ,
137+ schema : GraphQLSchema ,
138+ node : NameNode
139+ ) : string => {
135140 const typ = schema . getType ( node . value ) ;
136141
137142 if ( typ && typ . astNode ?. kind === 'InputObjectTypeDefinition' ) {
@@ -144,7 +149,7 @@ const generateNameNodeZodSchema = (tsVisitor: TsVisitor, schema: GraphQLSchema,
144149 return `${ enumName } Schema` ;
145150 }
146151
147- return zod4Scalar ( tsVisitor , node . value ) ;
152+ return zod4Scalar ( config , tsVisitor , node . value ) ;
148153} ;
149154
150155const maybeLazy = ( type : TypeNode , schema : string ) : string => {
@@ -154,7 +159,10 @@ const maybeLazy = (type: TypeNode, schema: string): string => {
154159 return schema ;
155160} ;
156161
157- const zod4Scalar = ( tsVisitor : TsVisitor , scalarName : string ) : string => {
162+ const zod4Scalar = ( config : ValidationSchemaPluginConfig , tsVisitor : TsVisitor , scalarName : string ) : string => {
163+ if ( config . scalarSchemas ?. [ scalarName ] ) {
164+ return config . scalarSchemas [ scalarName ] ;
165+ }
158166 const tsType = tsVisitor . scalars [ scalarName ] ;
159167 switch ( tsType ) {
160168 case 'string' :
0 commit comments