@@ -363,14 +363,15 @@ function checkEnumValues(schema, contextPath, config) {
363363
364364 for ( let i = 0 ; i < schema . enum . length ; i ++ ) {
365365 const enumValue = schema . enum [ i ] ;
366-
367- const checkStatus = config . snake_case_only || 'off' ;
368- if ( checkStatus . match ( 'error|warning' ) ) {
369- if ( ! isSnakecase ( enumValue ) ) {
370- result [ checkStatus ] . push ( {
371- path : contextPath . concat ( [ 'enum' , i . toString ( ) ] ) ,
372- message : 'Enum values must be lower snake case.'
373- } ) ;
366+ if ( typeof enumValue === 'string' ) {
367+ const checkStatus = config . snake_case_only || 'off' ;
368+ if ( checkStatus . match ( 'error|warning' ) ) {
369+ if ( ! isSnakecase ( enumValue ) ) {
370+ result [ checkStatus ] . push ( {
371+ path : contextPath . concat ( [ 'enum' , i . toString ( ) ] ) ,
372+ message : 'Enum values must be lower snake case.'
373+ } ) ;
374+ }
374375 }
375376 }
376377 }
@@ -398,16 +399,17 @@ function checkEnumCaseConvention(schema, contextPath, caseConvention) {
398399
399400 for ( let i = 0 ; i < schema . enum . length ; i ++ ) {
400401 const enumValue = schema . enum [ i ] ;
401-
402- const checkStatus = caseConvention [ 0 ] || 'off' ;
403- if ( checkStatus . match ( 'error|warning' ) ) {
404- const caseConventionValue = caseConvention [ 1 ] ;
405- const isCorrectCase = checkCase ( enumValue , caseConventionValue ) ;
406- if ( ! isCorrectCase ) {
407- result [ checkStatus ] . push ( {
408- path : contextPath . concat ( [ 'enum' , i . toString ( ) ] ) ,
409- message : `Enum values must follow case convention: ${ caseConventionValue } `
410- } ) ;
402+ if ( typeof enumValue === 'string' ) {
403+ const checkStatus = caseConvention [ 0 ] || 'off' ;
404+ if ( checkStatus . match ( 'error|warning' ) ) {
405+ const caseConventionValue = caseConvention [ 1 ] ;
406+ const isCorrectCase = checkCase ( enumValue , caseConventionValue ) ;
407+ if ( ! isCorrectCase ) {
408+ result [ checkStatus ] . push ( {
409+ path : contextPath . concat ( [ 'enum' , i . toString ( ) ] ) ,
410+ message : `Enum values must follow case convention: ${ caseConventionValue } `
411+ } ) ;
412+ }
411413 }
412414 }
413415 }
0 commit comments