@@ -10,23 +10,23 @@ import type {
1010 TypeNode ,
1111 UnionTypeDefinitionNode ,
1212} from 'graphql' ;
13- import type { ValidationSchemaPluginConfig } from '../config.js' ;
14- import type { Visitor } from '../visitor.js' ;
1513
1614import { resolveExternalModuleAndFn } from '@graphql-codegen/plugin-helpers' ;
17- import { convertNameParts , DeclarationBlock , indent } from '@graphql-codegen/visitor-plugin-common' ;
15+ import { DeclarationBlock , convertNameParts , indent } from '@graphql-codegen/visitor-plugin-common' ;
1816import {
1917 Kind ,
2018} from 'graphql' ;
19+ import type { Visitor } from '../visitor.js' ;
20+ import type { ValidationSchemaPluginConfig } from '../config.js' ;
2121import { buildApi , formatDirectiveConfig } from '../directive.js' ;
2222import {
23- escapeGraphQLCharacters ,
2423 InterfaceTypeDefinitionBuilder ,
24+ ObjectTypeDefinitionBuilder ,
25+ escapeGraphQLCharacters ,
2526 isInput ,
2627 isListType ,
2728 isNamedType ,
2829 isNonNullType ,
29- ObjectTypeDefinitionBuilder ,
3030} from '../graphql.js' ;
3131import { BaseSchemaVisitor } from '../schema_visitor.js' ;
3232
@@ -290,10 +290,10 @@ function generateFieldTypeMyZodSchema(config: ValidationSchemaPluginConfig, visi
290290
291291 if ( defaultValue ?. kind === Kind . STRING || defaultValue ?. kind === Kind . ENUM ) {
292292 if ( config . useEnumTypeAsDefaultValue && defaultValue ?. kind !== Kind . STRING ) {
293- let value = convertNameParts ( defaultValue . value , resolveExternalModuleAndFn ( 'change-case-all#pascalCase' ) ) ;
293+ let value = convertNameParts ( defaultValue . value , resolveExternalModuleAndFn ( 'change-case-all#pascalCase' ) , config ?. namingConvention ?. transformUnderscore ) ;
294294
295295 if ( config . namingConvention ?. enumValues )
296- value = convertNameParts ( defaultValue . value , resolveExternalModuleAndFn ( config . namingConvention ?. enumValues ) ) ;
296+ value = convertNameParts ( defaultValue . value , resolveExternalModuleAndFn ( config . namingConvention ?. enumValues ) , config ?. namingConvention ?. transformUnderscore ) ;
297297
298298 appliedDirectivesGen = `${ appliedDirectivesGen } .default(${ visitor . convertName ( type . name . value ) } .${ value } )` ;
299299 }
0 commit comments