@@ -100,7 +100,7 @@ testRule('xgen-IPA-123-allowable-enum-values-should-not-exceed-20', [
100100 errors : [
101101 {
102102 code : 'xgen-IPA-123-allowable-enum-values-should-not-exceed-20' ,
103- message : 'Inline enum arrays should not exceed 20 values. Current count: 21' ,
103+ message : 'The number of allowable enum values should not exceed 20 values. Current count: 21' ,
104104 path : [ 'components' , 'schemas' , 'TestSchema' , 'properties' , 'status' , 'enum' ] ,
105105 severity : DiagnosticSeverity . Error ,
106106 } ,
@@ -172,7 +172,7 @@ testRule('xgen-IPA-123-allowable-enum-values-should-not-exceed-20', [
172172 errors : [
173173 {
174174 code : 'xgen-IPA-123-allowable-enum-values-should-not-exceed-20' ,
175- message : 'Inline enum arrays should not exceed 20 values. Current count: 21' ,
175+ message : 'The number of allowable enum values should not exceed 20 values. Current count: 21' ,
176176 path : [ 'components' , 'schemas' , 'TestSchema' , 'properties' , 'priority' , 'enum' ] ,
177177 severity : DiagnosticSeverity . Error ,
178178 } ,
@@ -245,7 +245,7 @@ testRule('xgen-IPA-123-allowable-enum-values-should-not-exceed-20', [
245245 errors : [
246246 {
247247 code : 'xgen-IPA-123-allowable-enum-values-should-not-exceed-20' ,
248- message : 'Inline enum arrays should not exceed 20 values. Current count: 21' ,
248+ message : 'The number of allowable enum values should not exceed 20 values. Current count: 21' ,
249249 path : [ 'paths' , '/resources' , 'get' , 'parameters' , '0' , 'schema' , 'enum' ] ,
250250 severity : DiagnosticSeverity . Error ,
251251 } ,
@@ -303,7 +303,7 @@ testRule('xgen-IPA-123-allowable-enum-values-should-not-exceed-20', [
303303 errors : [ ] ,
304304 } ,
305305 {
306- name : 'valid on with reusable schemas' ,
306+ name : 'invalid on with reusable schemas' ,
307307 document : {
308308 paths : {
309309 '/resources' : {
@@ -362,6 +362,68 @@ testRule('xgen-IPA-123-allowable-enum-values-should-not-exceed-20', [
362362 } ,
363363 } ,
364364 } ,
365+ errors : [
366+ {
367+ code : 'xgen-IPA-123-allowable-enum-values-should-not-exceed-20' ,
368+ message : 'The number of allowable enum values should not exceed 20 values. Current count: 25' ,
369+ path : [ 'components' , 'schemas' , 'StatusEnum' , 'enum' ] ,
370+ severity : DiagnosticSeverity . Error ,
371+ } ,
372+ ] ,
373+ } ,
374+ {
375+ name : 'valid enum array in items schema' ,
376+ document : {
377+ components : {
378+ schemas : {
379+ TestSchema : {
380+ properties : {
381+ statusList : {
382+ type : 'array' ,
383+ items : {
384+ type : 'string' ,
385+ enum : [ 'PENDING' , 'ACTIVE' , 'COMPLETE' , 'FAILED' , 'CANCELLED' ] ,
386+ } ,
387+ } ,
388+ } ,
389+ } ,
390+ } ,
391+ } ,
392+ } ,
365393 errors : [ ] ,
366394 } ,
395+ {
396+ name : 'invalid enum array in items schema exceeding limit' ,
397+ document : {
398+ components : {
399+ schemas : {
400+ TestSchema : {
401+ properties : {
402+ statusList : {
403+ type : 'array' ,
404+ items : {
405+ type : 'string' ,
406+ enum : [
407+ 'VAL_1' , 'VAL_2' , 'VAL_3' , 'VAL_4' , 'VAL_5' ,
408+ 'VAL_6' , 'VAL_7' , 'VAL_8' , 'VAL_9' , 'VAL_10' ,
409+ 'VAL_11' , 'VAL_12' , 'VAL_13' , 'VAL_14' , 'VAL_15' ,
410+ 'VAL_16' , 'VAL_17' , 'VAL_18' , 'VAL_19' , 'VAL_20' ,
411+ 'VAL_21' ,
412+ ] ,
413+ } ,
414+ } ,
415+ } ,
416+ } ,
417+ } ,
418+ } ,
419+ } ,
420+ errors : [
421+ {
422+ code : 'xgen-IPA-123-allowable-enum-values-should-not-exceed-20' ,
423+ message : 'The number of allowable enum values should not exceed 20 values. Current count: 21' ,
424+ path : [ 'components' , 'schemas' , 'TestSchema' , 'properties' , 'statusList' , 'items' , 'enum' ] ,
425+ severity : DiagnosticSeverity . Error ,
426+ } ,
427+ ] ,
428+ } ,
367429] ) ;
0 commit comments