Skip to content

Commit 5590ee6

Browse files
fix(ipa): return internal errors as Spectral errors (#912)
1 parent 395dcdd commit 5590ee6

File tree

45 files changed

+56
-63
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+56
-63
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ function checkViolationsAndReturnErrors(input, path) {
2929
});
3030
return errors;
3131
} catch (e) {
32-
handleInternalError(RULE_NAME, path, e);
32+
return handleInternalError(RULE_NAME, path, e);
3333
}
3434
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function checkViolations(pathKey, path, ignoredValues = []) {
106106
}
107107
});
108108
} catch (e) {
109-
handleInternalError(RULE_NAME, [...path, pathKey], e);
109+
return handleInternalError(RULE_NAME, [...path, pathKey], e);
110110
}
111111

112112
return violations;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ function checkViolationsAndReturnErrors(suffixWithLeadingSlash, path) {
6767
}
6868
return [];
6969
} catch (e) {
70-
handleInternalError(RULE_NAME, path, e);
70+
return handleInternalError(RULE_NAME, path, e);
7171
}
7272
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
2-
hasGetMethod,
3-
isSingletonResource,
42
getResourcePathItems,
3+
hasGetMethod,
54
isResourceCollectionIdentifier,
65
isSingleResourceIdentifier,
6+
isSingletonResource,
77
} from './utils/resourceEvaluation.js';
88
import { evaluateAndCollectAdoptionStatus, handleInternalError } from './utils/collectionUtils.js';
99

@@ -42,6 +42,6 @@ function checkViolationsAndReturnErrors(oasPaths, input, path) {
4242
}
4343
return [];
4444
} catch (e) {
45-
handleInternalError(RULE_NAME, path, e);
45+
return handleInternalError(RULE_NAME, path, e);
4646
}
4747
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ function checkViolationsAndReturnErrors(contentPerMediaType, path, isSingleton)
5252
}
5353
return [];
5454
} catch (e) {
55-
handleInternalError(RULE_NAME, path, e);
55+
return handleInternalError(RULE_NAME, path, e);
5656
}
5757
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
} from './utils/resourceEvaluation.js';
66
import { resolveObject } from './utils/componentUtils.js';
77
import { evaluateAndCollectAdoptionStatus, handleInternalError } from './utils/collectionUtils.js';
8-
import { getSchemaRef, getSchemaNameFromRef, getResponseOfGetMethodByMediaType } from './utils/methodUtils.js';
8+
import { getResponseOfGetMethodByMediaType, getSchemaNameFromRef, getSchemaRef } from './utils/methodUtils.js';
99
import { schemaIsPaginated } from './utils/schemaUtils.js';
1010

1111
const RULE_NAME = 'xgen-IPA-105-list-method-response-is-get-method-response';
@@ -93,6 +93,6 @@ function checkViolationsAndReturnErrors(path, listMethodResultItems, getMethodRe
9393
}
9494
return [];
9595
} catch (e) {
96-
handleInternalError(RULE_NAME, path, e);
96+
return handleInternalError(RULE_NAME, path, e);
9797
}
9898
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
} from './utils/resourceEvaluation.js';
66
import { resolveObject } from './utils/componentUtils.js';
77
import { evaluateAndCollectAdoptionStatus, handleInternalError } from './utils/collectionUtils.js';
8-
import { getSchemaRef, getResponseOfGetMethodByMediaType } from './utils/methodUtils.js';
8+
import { getResponseOfGetMethodByMediaType, getSchemaRef } from './utils/methodUtils.js';
99

1010
const RULE_NAME = 'xgen-IPA-106-create-method-response-is-get-method-response';
1111
const ERROR_MESSAGE =
@@ -72,6 +72,6 @@ function checkViolationsAndReturnErrors(path, createMethodResponseContent, getMe
7272
}
7373
return [];
7474
} catch (e) {
75-
handleInternalError(RULE_NAME, path, e);
75+
return handleInternalError(RULE_NAME, path, e);
7676
}
7777
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ function checkViolationsAndReturnErrors(postMethodParameters, path, opts) {
5050
}
5151
return errors;
5252
} catch (e) {
53-
handleInternalError(RULE_NAME, path, e);
53+
return handleInternalError(RULE_NAME, path, e);
5454
}
5555
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ function checkViolationsAndReturnErrors(postMethodParameters, path, ruleName, op
5151
}
5252
return errors;
5353
} catch (e) {
54-
handleInternalError(ruleName, path, e);
54+
return handleInternalError(ruleName, path, e);
5555
}
5656
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from './utils/resourceEvaluation.js';
77
import { resolveObject } from './utils/componentUtils.js';
88
import { evaluateAndCollectAdoptionStatus, handleInternalError } from './utils/collectionUtils.js';
9-
import { getSchemaRef, getGETMethodResponseSchemaFromPathItem } from './utils/methodUtils.js';
9+
import { getGETMethodResponseSchemaFromPathItem, getSchemaRef } from './utils/methodUtils.js';
1010

1111
const RULE_NAME = 'xgen-IPA-107-update-method-response-is-get-method-response';
1212
const ERROR_MESSAGE =
@@ -84,6 +84,6 @@ function checkViolationsAndReturnErrors(path, updateMethodResponseContent, getMe
8484
}
8585
return [];
8686
} catch (e) {
87-
handleInternalError(RULE_NAME, path, e);
87+
return handleInternalError(RULE_NAME, path, e);
8888
}
8989
}

0 commit comments

Comments
 (0)