@@ -10,23 +10,23 @@ import type {
10
10
TypeNode ,
11
11
UnionTypeDefinitionNode ,
12
12
} from 'graphql' ;
13
- import type { ValidationSchemaPluginConfig } from '../config.js' ;
14
- import type { Visitor } from '../visitor.js' ;
15
13
16
14
import { 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' ;
18
16
import {
19
17
Kind ,
20
18
} from 'graphql' ;
19
+ import type { Visitor } from '../visitor.js' ;
20
+ import type { ValidationSchemaPluginConfig } from '../config.js' ;
21
21
import { buildApi , formatDirectiveConfig } from '../directive.js' ;
22
22
import {
23
- escapeGraphQLCharacters ,
24
23
InterfaceTypeDefinitionBuilder ,
24
+ ObjectTypeDefinitionBuilder ,
25
+ escapeGraphQLCharacters ,
25
26
isInput ,
26
27
isListType ,
27
28
isNamedType ,
28
29
isNonNullType ,
29
- ObjectTypeDefinitionBuilder ,
30
30
} from '../graphql.js' ;
31
31
import { BaseSchemaVisitor } from '../schema_visitor.js' ;
32
32
@@ -290,10 +290,10 @@ function generateFieldTypeMyZodSchema(config: ValidationSchemaPluginConfig, visi
290
290
291
291
if ( defaultValue ?. kind === Kind . STRING || defaultValue ?. kind === Kind . ENUM ) {
292
292
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 ) ;
294
294
295
295
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 ) ;
297
297
298
298
appliedDirectivesGen = `${ appliedDirectivesGen } .default(${ visitor . convertName ( type . name . value ) } .${ value } )` ;
299
299
}
0 commit comments