Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions openapi/.raw/v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -53063,6 +53063,57 @@
"x-xgen-IPA-exception": {
"xgen-IPA-102-path-alternate-resource-name-path-param": "API predates IPA validation"
}
},
"/api/atlas/v2/alertConfigs/matchers/fieldNames/{fieldId}": {
"get": {
"description": "Get all field names that the `matchers.fieldName` parameter accepts when you create or update an Alert Configuration. You can successfully call this endpoint with any assigned role.",
"operationId": "listAlertConfigurationMatchersFieldNames",
"parameters": [
{
"$ref": "#/components/parameters/envelope"
},
{
"$ref": "#/components/parameters/pretty"
}
],
"responses": {
"200": {
"content": {
"application/vnd.atlas.2023-01-01+json": {
"schema": {
"items": {
"$ref": "#/components/schemas/MatcherFieldView"
},
"type": "array",
"x-xgen-IPA-exception": {
"xgen-IPA-124-array-max-items": "Schema predates IPA validation"
}
},
"x-xgen-version": "2023-01-01"
}
},
"description": "OK"
},
"401": {
"$ref": "#/components/responses/unauthorized"
},
"403": {
"$ref": "#/components/responses/forbidden"
},
"404": {
"$ref": "#/components/responses/notFound"
},
"500": {
"$ref": "#/components/responses/internalServerError"
}
},
"summary": "Return All Alert Configuration Matchers Field Names",
"tags": [
"Alert Configurations"
],
"x-xgen-docs-url": "https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Alert-Configurations/operation/listAlertConfigurationMatchersFieldNames",
"x-xgen-owner-team": "CAP"
}
},
"/api/atlas/v2/clusters": {
"get": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,25 @@ const validatePathStructure = (elements) => {
});
};

const findExceptionInPathHierarchy = (oas, currentPath, ruleName) => {
// Check current path first
if (hasException(oas.paths[currentPath], ruleName)) {
return currentPath;
}

// Check parent paths by removing segments from the end
const pathSegments = currentPath.split('/').filter(segment => segment !== '');

for (let i = pathSegments.length - 1; i > 0; i--) {
const parentPath = '/' + pathSegments.slice(0, i).join('/');
if (oas.paths[parentPath] && hasException(oas.paths[parentPath], ruleName)) {
return parentPath;
}
}

return null;
}

export default (input, _, { path, documentInventory }) => {
const oas = documentInventory.resolved;

Expand All @@ -41,8 +60,9 @@ export default (input, _, { path, documentInventory }) => {
return;
}

if (hasException(oas.paths[input], RULE_NAME)) {
collectException(oas.paths[input], RULE_NAME, path);
const exceptionPath = findExceptionInPathHierarchy(oas, input, RULE_NAME);
if (exceptionPath) {
collectException(oas.paths[exceptionPath], RULE_NAME, path);
return;
}

Expand All @@ -64,4 +84,4 @@ function checkViolationsAndReturnErrors(suffixWithLeadingSlash, path) {
} catch (e) {
handleInternalError(RULE_NAME, path, e);
}
}
}
Loading