Skip to content

Commit 9839ef2

Browse files
committed
Removed rule TenantLevelAPIsNotAllowed RPC-Uri-V1-11
1 parent 21c0234 commit 9839ef2

8 files changed

Lines changed: 19 additions & 255 deletions

File tree

docs/rules.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -942,12 +942,6 @@ For more detail, pls refer to https://github.com/microsoft/api-guidelines/blob/v
942942

943943
Please refer to [path-resource-type-name-camel-case.md](./path-resource-type-name-camel-case.md) for details.
944944

945-
### Post201Response
946-
947-
Using post for a create operation is discouraged.
948-
949-
Please refer to [post201-response.md](./post201-response.md) for details.
950-
951945
### PostOperationIdContainsUrlVerb
952946

953947
A POST operation's operationId should contain the verb indicated at the end of the corresponding url.
@@ -962,6 +956,12 @@ Long-running POST operations must have responses with 202 and default return cod
962956

963957
Please refer to [post-response-codes.md](./post-response-codes.md) for details.
964958

959+
### Post201Response
960+
961+
Using post for a create operation is discouraged.
962+
963+
Please refer to [post201-response.md](./post201-response.md) for details.
964+
965965
### PreviewVersionOverOneYear
966966

967967
Per [Retirement-of-Previews](https://dev.azure.com/msazure/AzureWiki/_wiki/wikis/AzureWiki.wiki/37683/Retirement-of-Previews), service, feature, API, and SKU in preview for over one year need to move to GA or retire.
@@ -1244,12 +1244,6 @@ Please refer to [system-data-in-properties-bag.md](./system-data-in-properties-b
12441244

12451245
Please refer to [tags-are-not-allowed-for-proxy-resources.md](./tags-are-not-allowed-for-proxy-resources.md) for details.
12461246

1247-
### TenantLevelAPIsNotAllowed
1248-
1249-
Tenant level APIs are strongly discouraged and subscription or resource group level APIs are preferred instead. The reason for this guidance is that tenant level APIs have a really broad scope and blast radius. We permit APIs to be at this broad scope under rare conditions. Some ARM feature sets also do not cover tenant level APIs such as the use of AFEC. Additionally, if you intend to bypass the standard RBAC constructs and make the APIs unauthorized, you will need an approval from the PAS team before the open API spec can be merged.
1250-
1251-
Please refer to [tenant-level-apis-not-allowed.md](./tenant-level-apis-not-allowed.md) for details.
1252-
12531247
### TopLevelResourcesListByResourceGroup
12541248

12551249
Per [ARM guidelines](https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md), all the top-level resources must have a list by resource group operation which returns the collection of the resource.

docs/tenant-level-apis-not-allowed.md

Lines changed: 0 additions & 51 deletions
This file was deleted.

packages/rulesets/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Change Log - @microsoft.azure/openapi-validator-rulesets
22

3+
## 2.1.8
4+
5+
### Patches
6+
7+
- Removed rule TenantLevelAPIsNotAllowed RPC-Uri-V1-11
8+
9+
## 2.1.7
10+
11+
### Patches
12+
13+
- Updated autorest package.json to 2.2.4
14+
315
## 2.1.6
416

517
### Patches

packages/rulesets/generated/spectral/az-arm.js

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2965,28 +2965,6 @@ const tagsAreNotAllowedForProxyResources = (definition, _opts, ctx) => {
29652965
return errors;
29662966
};
29672967

2968-
const tenantLevelAPIsNotAllowed = (pathItems, _opts, ctx) => {
2969-
if (pathItems === null || typeof pathItems !== "object") {
2970-
return [];
2971-
}
2972-
const path = ctx.path || [];
2973-
const apiPaths = Object.keys(pathItems);
2974-
if (apiPaths.length < 1) {
2975-
return [];
2976-
}
2977-
const errors = [];
2978-
for (const apiPath of apiPaths) {
2979-
if (pathItems[apiPath]["put"] && !apiPath.endsWith("/operations") && apiPath.startsWith("/providers")) {
2980-
errors.push({
2981-
message: `${apiPath} is a tenant level api. Tenant level APIs are strongly discouraged and subscription or resource group level APIs are preferred instead. If you cannot model your APIs at these levels, you will need to present your design and get an exception from PAS team.`,
2982-
path: [...path, apiPath],
2983-
});
2984-
break;
2985-
}
2986-
}
2987-
return errors;
2988-
};
2989-
29902968
const trackedExtensionResourcesAreNotAllowed = (apiPath, _opts, ctx) => {
29912969
var _a, _b, _c;
29922970
if (apiPath === null || typeof apiPath !== "string") {
@@ -3974,18 +3952,6 @@ const ruleset = {
39743952
function: noDuplicatePathsForScopeParameter,
39753953
},
39763954
},
3977-
TenantLevelAPIsNotAllowed: {
3978-
rpcGuidelineCode: "RPC-Uri-V1-11",
3979-
description: "Tenant level APIs are strongly discouraged and subscription or resource group level APIs are preferred instead. Design presentation and getting an exception from the PAS team is needed if APIs cannot be modelled at subscription or resource group level.",
3980-
message: "{{error}}",
3981-
severity: "error",
3982-
resolved: true,
3983-
formats: [oas2],
3984-
given: "$[paths,'x-ms-paths']",
3985-
then: {
3986-
function: tenantLevelAPIsNotAllowed,
3987-
},
3988-
},
39893955
TrackedExtensionResourcesAreNotAllowed: {
39903956
rpcGuidelineCode: "RPC-Uri-V1-12",
39913957
description: "Extension resources are always considered to be proxy and must not be of the type tracked.",

packages/rulesets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft.azure/openapi-validator-rulesets",
3-
"version": "2.1.7",
3+
"version": "2.1.8",
44
"description": "Azure OpenAPI Validator",
55
"main": "dist/index.js",
66
"scripts": {

packages/rulesets/src/spectral/az-arm.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ import { securityDefinitionsStructure } from "./functions/security-definitions-s
5050
import skuValidation from "./functions/sku-validation"
5151
import { systemDataInPropertiesBag } from "./functions/system-data-in-properties-bag"
5252
import { tagsAreNotAllowedForProxyResources } from "./functions/tags-are-not-allowed-for-proxy-resources"
53-
import { tenantLevelAPIsNotAllowed } from "./functions/tenant-level-apis-not-allowed"
5453
import { trackedExtensionResourcesAreNotAllowed } from "./functions/tracked-extension-resources-are-not-allowed"
5554
import trackedResourceTagsPropertyInRequest from "./functions/trackedresource-tags-property-in-request"
5655
import { validQueryParametersForPointOperations } from "./functions/valid-query-parameters-for-point-operations"
@@ -946,20 +945,6 @@ const ruleset: any = {
946945
function: noDuplicatePathsForScopeParameter,
947946
},
948947
},
949-
// RPC Code: RPC-Uri-V1-11
950-
TenantLevelAPIsNotAllowed: {
951-
rpcGuidelineCode: "RPC-Uri-V1-11",
952-
description:
953-
"Tenant level APIs are strongly discouraged and subscription or resource group level APIs are preferred instead. Design presentation and getting an exception from the PAS team is needed if APIs cannot be modelled at subscription or resource group level.",
954-
message: "{{error}}",
955-
severity: "error",
956-
resolved: true,
957-
formats: [oas2],
958-
given: "$[paths,'x-ms-paths']",
959-
then: {
960-
function: tenantLevelAPIsNotAllowed,
961-
},
962-
},
963948
// RPC Code: RPC-Uri-V1-12
964949
TrackedExtensionResourcesAreNotAllowed: {
965950
rpcGuidelineCode: "RPC-Uri-V1-12",

packages/rulesets/src/spectral/functions/tenant-level-apis-not-allowed.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

packages/rulesets/src/spectral/test/tenant-level-apis-not-allowed.test.ts

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)