Skip to content

Commit 4d9bf07

Browse files
maxEnumValues parameter
1 parent 0b1f8fa commit 4d9bf07

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

tools/spectral/ipa/rulesets/IPA-123.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ rules:
3838
given: '$..enum'
3939
then:
4040
function: 'IPA123EnumValuesShouldNotExceed20'
41+
functionOptions:
42+
maxEnumValues: 20

tools/spectral/ipa/rulesets/functions/IPA123EnumValuesShouldNotExceed20.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import { resolveObject } from './utils/componentUtils.js';
55

66
const RULE_NAME = 'xgen-IPA-123-allowable-enum-values-should-not-exceed-20';
77
const ERROR_MESSAGE = 'Inline enum arrays should not exceed 20 values. Current count: ';
8-
const MAX_ENUM_VALUES = 20;
98

10-
export default (input, options, { path, documentInventory }) => {
9+
export default (input, { maxEnumValues }, { path, documentInventory }) => {
1110
const oas = documentInventory.resolved;
1211
const schemaPath = getSchemaPathFromEnumPath(path);
1312
const schemaObject = resolveObject(oas, schemaPath);
@@ -27,7 +26,7 @@ export default (input, options, { path, documentInventory }) => {
2726
return;
2827
}
2928

30-
if (input.length > MAX_ENUM_VALUES) {
29+
if (input.length > maxEnumValues) {
3130
return collectAndReturnViolation(path, RULE_NAME, [
3231
{
3332
path,

0 commit comments

Comments
 (0)