Skip to content

Commit 5e7a26e

Browse files
author
Sophia Marie Terry
committed
CLOUDP-328959: Added exception handling and removed used variables
1 parent f47ef0a commit 5e7a26e

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ import { generateOperationID } from './utils/operationIdGeneration.js';
55

66
const RULE_NAME = 'xgen-IPA-106-valid-operation-id';
77
const ERROR_MESSAGE =
8-
'Invalid OperationID. The Operation ID must start with the verb “create” and should be followed by a noun or compound noun. The noun(s) in the Operation ID should be the collection identifiers from the resource identifier in singular form';
8+
'Invalid OperationID. The Operation ID must start with the verb “create” and should be followed by a noun or compound noun. The noun(s) in the Operation ID should be the collection identifiers from the resource identifier in singular form.';
99

1010
export default (input, _, { path, documentInventory }) => {
1111
let resourcePath = path[1];
12-
const oas = documentInventory.resolved;
1312
let methodName = 'create';
1413

15-
// TODO detect exceptions
14+
if (hasException(createMethodResponse, RULE_NAME)) {
15+
collectException(createMethodResponse, RULE_NAME, path);
16+
return;
17+
}
18+
19+
// TODO detect custom method extension - CLOUDP-306294
1620

1721
if (isCustomMethodIdentifier(resourcePath)) {
1822
methodName = getCustomMethodName(resourcePath);

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ const ERROR_MESSAGE =
99

1010
export default (input, _, { path, documentInventory }) => {
1111
let resourcePath = path[1];
12-
const oas = documentInventory.resolved;
1312
let methodName = 'update';
1413

15-
// TODO detect exceptions
14+
if (hasException(createMethodResponse, RULE_NAME)) {
15+
collectException(createMethodResponse, RULE_NAME, path);
16+
return;
17+
}
18+
19+
// TODO detect custom method extension - CLOUDP-306294
1620

1721
if (isCustomMethodIdentifier(resourcePath)) {
1822
methodName = getCustomMethodName(resourcePath);

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ const ERROR_MESSAGE =
99

1010
export default (input, _, { path, documentInventory }) => {
1111
let resourcePath = path[1];
12-
const oas = documentInventory.resolved;
1312
let methodName = 'delete';
1413

15-
// TODO detect exceptions
14+
if (hasException(createMethodResponse, RULE_NAME)) {
15+
collectException(createMethodResponse, RULE_NAME, path);
16+
return;
17+
}
18+
19+
// TODO detect custom method extension - CLOUDP-306294
1620

1721
if (isCustomMethodIdentifier(resourcePath)) {
1822
methodName = getCustomMethodName(resourcePath);

0 commit comments

Comments
 (0)