1- import  {  DeclarationBlock ,  indent  }  from  '@graphql-codegen/visitor-plugin-common' ; 
1+ import  {  DeclarationBlock ,  convertNameParts ,   indent  }  from  '@graphql-codegen/visitor-plugin-common' ; 
22import  type  { 
33  EnumTypeDefinitionNode , 
44  FieldDefinitionNode , 
@@ -14,7 +14,6 @@ import type {
1414import  { 
1515  Kind , 
1616}  from  'graphql' ; 
17- import  {  pascalCase  }  from  "change-case" ; 
1817
1918import  type  {  ValidationSchemaPluginConfig  }  from  '../config' ; 
2019import  {  buildApi ,  formatDirectiveConfig  }  from  '../directive' ; 
@@ -28,6 +27,7 @@ import {
2827  isNamedType , 
2928  isNonNullType , 
3029}  from  './../graphql' ; 
30+ import  {  resolveExternalModuleAndFn  }  from  '@graphql-codegen/plugin-helpers' ; 
3131
3232export  class  YupSchemaVisitor  extends  BaseSchemaVisitor  { 
3333  constructor ( schema : GraphQLSchema ,  config : ValidationSchemaPluginConfig )  { 
@@ -286,7 +286,13 @@ function shapeFields(fields: readonly (FieldDefinitionNode | InputValueDefinitio
286286
287287        if  ( defaultValue ?. kind  ===  Kind . STRING  ||  defaultValue ?. kind  ===  Kind . ENUM )  { 
288288          if  ( config . useEnumTypeAsDefaultValue  &&  defaultValue ?. kind  !==  Kind . STRING )  { 
289-             fieldSchema  =  `${ fieldSchema } ${ visitor . convertName ( field . name . value ) } ${ pascalCase ( defaultValue . value ) }  ; 
289+             let  value  =  convertNameParts ( defaultValue . value ,  resolveExternalModuleAndFn ( "change-case-all#pascalCase" ) ) ; 
290+ 
291+             if  ( config . namingConvention ?. enumValues )  { 
292+               value  =  convertNameParts ( defaultValue . value ,  resolveExternalModuleAndFn ( config . namingConvention ?. enumValues ) ) ; 
293+             } 
294+ 
295+             fieldSchema  =  `${ fieldSchema } ${ visitor . convertName ( field . name . value ) } ${ value }  ; 
290296          }  else  { 
291297            fieldSchema  =  `${ fieldSchema } ${ defaultValue . value }  ; 
292298          } 
0 commit comments