Skip to content

Commit de6039e

Browse files
logic fix
1 parent c93b6eb commit de6039e

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

tools/spectral/ipa/__tests__/IPA005ExceptionExtensionFormat.test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ testRule('xgen-IPA-005-exception-extension-format', [
9292
errors: [
9393
{
9494
code: 'xgen-IPA-005-exception-extension-format',
95-
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX-{rule-name} format.',
95+
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX or xgen-IPA-XXX-{rule-name} format.',
9696
path: ['paths', '/path1', 'x-xgen-IPA-exception'],
9797
severity: DiagnosticSeverity.Error,
9898
},
@@ -104,7 +104,7 @@ testRule('xgen-IPA-005-exception-extension-format', [
104104
},
105105
{
106106
code: 'xgen-IPA-005-exception-extension-format',
107-
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX-{rule-name} format.',
107+
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX or xgen-IPA-XXX-{rule-name} format.',
108108
path: ['paths', '/path3', 'x-xgen-IPA-exception'],
109109
severity: DiagnosticSeverity.Error,
110110
},
@@ -116,31 +116,31 @@ testRule('xgen-IPA-005-exception-extension-format', [
116116
},
117117
{
118118
code: 'xgen-IPA-005-exception-extension-format',
119-
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX-{rule-name} format.',
119+
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX or xgen-IPA-XXX-{rule-name} format.',
120120
path: ['paths', '/path5', 'x-xgen-IPA-exception'],
121121
severity: DiagnosticSeverity.Error,
122122
},
123123
{
124124
code: 'xgen-IPA-005-exception-extension-format',
125-
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX-{rule-name} format.',
125+
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX or xgen-IPA-XXX-{rule-name} format.',
126126
path: ['paths', '/path6', 'x-xgen-IPA-exception'],
127127
severity: DiagnosticSeverity.Error,
128128
},
129129
{
130130
code: 'xgen-IPA-005-exception-extension-format',
131-
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX-{rule-name} format.',
131+
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX or xgen-IPA-XXX-{rule-name} format.',
132132
path: ['paths', '/path7', 'x-xgen-IPA-exception'],
133133
severity: DiagnosticSeverity.Error,
134134
},
135135
{
136136
code: 'xgen-IPA-005-exception-extension-format',
137-
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX-{rule-name} format.',
137+
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX or xgen-IPA-XXX-{rule-name} format.',
138138
path: ['paths', '/path8', 'x-xgen-IPA-exception'],
139139
severity: DiagnosticSeverity.Error,
140140
},
141141
{
142142
code: 'xgen-IPA-005-exception-extension-format',
143-
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX-{rule-name} format.',
143+
message: 'IPA exceptions must have a valid key following xgen-IPA-XXX or xgen-IPA-XXX-{rule-name} format.',
144144
path: ['paths', '/path9', 'x-xgen-IPA-exception'],
145145
severity: DiagnosticSeverity.Error,
146146
},

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ rules:
1212
##### Implementation details
1313
Rule checks for the following conditions:
1414
- Exception rule names must start with 'xgen-IPA-' prefix
15+
- Exception rule names can be either short format (xgen-IPA-XXX) or full format (xgen-IPA-XXX-rule-name)
1516
- Each exception must include a non-empty reason as a string that starts with uppercase and ends with a full stop
1617
- This rule itself does not allow exceptions
1718
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-005-exception-extension-format'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
handleInternalError,
44
} from './utils/collectionUtils.js';
55

6-
const ERROR_MESSAGE_RULENAME_FORMAT = 'IPA exceptions must have a valid key following xgen-IPA-XXX-{rule-name} format.';
6+
const ERROR_MESSAGE_RULENAME_FORMAT = 'IPA exceptions must have a valid key following xgen-IPA-XXX or xgen-IPA-XXX-{rule-name} format.';
77
const ERROR_MESSAGE_REASON_FORMAT =
88
'IPA exceptions must have a non-empty reason that starts with uppercase and ends with a full stop.';
99
const RULE_NAME_PATTERN = /^xgen-IPA-\d{3}(?:-[a-z-]+)?$/;

0 commit comments

Comments
 (0)