Skip to content

Commit 65ddb0d

Browse files
test commit
1 parent 453b1c7 commit 65ddb0d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { hasException } from './utils/exceptions.js';
22
import {
3-
collectAdoption,
4-
collectException,
3+
collectAdoption, collectAndReturnViolation,
4+
collectException, handleInternalError,
55
} from './utils/collectionUtils.js';
66
import { resolveObject } from './utils/componentUtils.js';
7+
import { getSchemaNameFromRef } from './utils/methodUtils.js';
78

89
const RULE_NAME = 'xgen-IPA-114-error-responses-refer-to-api-error';
910

@@ -25,14 +26,14 @@ export default (input, _, { path, documentInventory }) => {
2526
return;
2627
}
2728

28-
/*const errors = checkViolationsAndReturnErrors(apiResponseObject, oas, path, errorCode);
29+
const errors = checkViolationsAndReturnErrors(apiResponseObject, oas, path, errorCode);
2930
if (errors.length !== 0) {
3031
return collectAndReturnViolation(path, RULE_NAME, errors);
3132
}
32-
*/
33+
3334
collectAdoption(path, RULE_NAME);
3435
};
35-
/*
36+
3637
function checkViolationsAndReturnErrors(apiResponseObject, oas, path, errorCode) {
3738
try {
3839
const errors = [];
@@ -48,6 +49,7 @@ function checkViolationsAndReturnErrors(apiResponseObject, oas, path, errorCode)
4849
return [{ path, message: `${errorCode} response must define content with ApiError schema reference.` }];
4950
}
5051

52+
/*
5153
for (const [mediaType, mediaTypeObj] of Object.entries(content)) {
5254
if (!mediaType.endsWith('json')) {
5355
continue;
@@ -72,10 +74,9 @@ function checkViolationsAndReturnErrors(apiResponseObject, oas, path, errorCode)
7274
message: `${errorCode} response must reference ApiError schema.`,
7375
});
7476
}
75-
}
77+
}*/
7678
return errors;
7779
} catch (e) {
7880
handleInternalError(RULE_NAME, path, e);
7981
}
8082
}
81-
*/

0 commit comments

Comments
 (0)