Skip to content

Commit edb6559

Browse files
authored
Tejaswis/remove rpc async v1 07 (#748)
* Removed RPC-Async-V1-07 rule * Removed RPC-Async-V1-07 rule and related context
1 parent c26c69a commit edb6559

File tree

6 files changed

+0
-5494
lines changed

6 files changed

+0
-5494
lines changed

docs/lro-location-header.md

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

docs/rules.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -514,12 +514,6 @@ A 202 response should include an `Operation-Location` response header.
514514

515515
Please refer to [lro-headers.md](./lro-headers.md) for details.
516516

517-
### LroLocationHeader
518-
519-
Location header must be supported for all async operations that return 202.
520-
521-
Please refer to [lro-location-header.md](./lro-location-header.md) for details.
522-
523517
### ProvisioningStateSpecifiedForLROPatch
524518

525519
This is a rule introduced to validate if a LRO PATCH operations response schema has "ProvisioningState" property specified for the 200 status code.

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,27 +1677,6 @@ const hasApiVersionParameter = (apiPath, opts, paths) => {
16771677
return messages;
16781678
};
16791679

1680-
const hasHeader = (response, opts, paths) => {
1681-
if (response === null || typeof response !== 'object') {
1682-
return [];
1683-
}
1684-
if (opts === null || typeof opts !== 'object' || !opts.name) {
1685-
return [];
1686-
}
1687-
const path = paths.path || [];
1688-
const hasHeader = Object.keys(response.headers || {})
1689-
.some((name) => name.toLowerCase() === opts.name.toLowerCase());
1690-
if (!hasHeader) {
1691-
return [
1692-
{
1693-
message: `Response should include an "${opts.name}" response header.`,
1694-
path: [...path, 'headers'],
1695-
},
1696-
];
1697-
}
1698-
return [];
1699-
};
1700-
17011680
const httpsSupportedScheme = (scheme, _opts, paths) => {
17021681
if (scheme == null || typeof scheme !== "object")
17031682
return [];
@@ -3301,22 +3280,6 @@ const ruleset = {
33013280
function: provisioningState,
33023281
},
33033282
},
3304-
LroLocationHeader: {
3305-
rpcGuidelineCode: "RPC-Async-V1-07",
3306-
description: "Location header must be supported for all async operations that return 202.",
3307-
message: "A 202 response should include an Location response header.",
3308-
severity: "error",
3309-
disableForTypeSpecDataPlane: true,
3310-
disableForTypeSpecDataPlaneReason: "Covered by TSP's '@azure-tools/typespec-azure-resource-manager/arm-location-header' rule.",
3311-
formats: [oas2],
3312-
given: "$.paths[*][*].responses[?(@property == '202')]",
3313-
then: {
3314-
function: hasHeader,
3315-
functionOptions: {
3316-
name: "Location",
3317-
},
3318-
},
3319-
},
33203283
PostResponseCodes: {
33213284
rpcGuidelineCode: "RPC-Async-V1-11, RPC-Async-V1-14",
33223285
description: "Synchronous POST must have either 200 or 204 return codes and LRO POST must have 202 return code. LRO POST should also have a 200 return code only if the final response is intended to have a schema",

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { DeleteResponseCodes } from "./functions/delete-response-codes"
1111
import { getCollectionOnlyHasValueAndNextLink } from "./functions/get-collection-only-has-value-and-next-link"
1212
import { getResponseCodes } from "./functions/get-response-codes"
1313
import hasApiVersionParameter from "./functions/has-api-version-parameter"
14-
import hasheader from "./functions/has-header"
1514
import httpsSupportedScheme from "./functions/https-supported-scheme"
1615
import { latestVersionOfCommonTypesMustBeUsed } from "./functions/latest-version-of-common-types-must-be-used"
1716
import locationMustHaveXmsMutability from "./functions/location-must-have-xms-mutability"
@@ -158,24 +157,6 @@ const ruleset: any = {
158157
},
159158
},
160159

161-
// RPC Code: RPC-Async-V1-07
162-
LroLocationHeader: {
163-
rpcGuidelineCode: "RPC-Async-V1-07",
164-
description: "Location header must be supported for all async operations that return 202.",
165-
message: "A 202 response should include an Location response header.",
166-
severity: "error",
167-
disableForTypeSpecDataPlane: true,
168-
disableForTypeSpecDataPlaneReason: "Covered by TSP's '@azure-tools/typespec-azure-resource-manager/arm-location-header' rule.",
169-
formats: [oas2],
170-
given: "$.paths[*][*].responses[?(@property == '202')]",
171-
then: {
172-
function: hasheader,
173-
functionOptions: {
174-
name: "Location",
175-
},
176-
},
177-
},
178-
179160
// RPC Code: RPC-Async-V1-11, RPC-Async-V1-14
180161
PostResponseCodes: {
181162
rpcGuidelineCode: "RPC-Async-V1-11, RPC-Async-V1-14",

0 commit comments

Comments
 (0)