Skip to content

Commit

Permalink
Tejaswis/remove rpc async v1 07 (#748)
Browse files Browse the repository at this point in the history
* Removed RPC-Async-V1-07 rule

* Removed RPC-Async-V1-07 rule and related context
  • Loading branch information
tejaswiMinnu authored Oct 16, 2024
1 parent c26c69a commit edb6559
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 5,494 deletions.
49 changes: 0 additions & 49 deletions docs/lro-location-header.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,12 +514,6 @@ A 202 response should include an `Operation-Location` response header.

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

### LroLocationHeader

Location header must be supported for all async operations that return 202.

Please refer to [lro-location-header.md](./lro-location-header.md) for details.

### ProvisioningStateSpecifiedForLROPatch

This is a rule introduced to validate if a LRO PATCH operations response schema has "ProvisioningState" property specified for the 200 status code.
Expand Down
37 changes: 0 additions & 37 deletions packages/rulesets/generated/spectral/az-arm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1677,27 +1677,6 @@ const hasApiVersionParameter = (apiPath, opts, paths) => {
return messages;
};

const hasHeader = (response, opts, paths) => {
if (response === null || typeof response !== 'object') {
return [];
}
if (opts === null || typeof opts !== 'object' || !opts.name) {
return [];
}
const path = paths.path || [];
const hasHeader = Object.keys(response.headers || {})
.some((name) => name.toLowerCase() === opts.name.toLowerCase());
if (!hasHeader) {
return [
{
message: `Response should include an "${opts.name}" response header.`,
path: [...path, 'headers'],
},
];
}
return [];
};

const httpsSupportedScheme = (scheme, _opts, paths) => {
if (scheme == null || typeof scheme !== "object")
return [];
Expand Down Expand Up @@ -3301,22 +3280,6 @@ const ruleset = {
function: provisioningState,
},
},
LroLocationHeader: {
rpcGuidelineCode: "RPC-Async-V1-07",
description: "Location header must be supported for all async operations that return 202.",
message: "A 202 response should include an Location response header.",
severity: "error",
disableForTypeSpecDataPlane: true,
disableForTypeSpecDataPlaneReason: "Covered by TSP's '@azure-tools/typespec-azure-resource-manager/arm-location-header' rule.",
formats: [oas2],
given: "$.paths[*][*].responses[?(@property == '202')]",
then: {
function: hasHeader,
functionOptions: {
name: "Location",
},
},
},
PostResponseCodes: {
rpcGuidelineCode: "RPC-Async-V1-11, RPC-Async-V1-14",
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",
Expand Down
19 changes: 0 additions & 19 deletions packages/rulesets/src/spectral/az-arm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { DeleteResponseCodes } from "./functions/delete-response-codes"
import { getCollectionOnlyHasValueAndNextLink } from "./functions/get-collection-only-has-value-and-next-link"
import { getResponseCodes } from "./functions/get-response-codes"
import hasApiVersionParameter from "./functions/has-api-version-parameter"
import hasheader from "./functions/has-header"
import httpsSupportedScheme from "./functions/https-supported-scheme"
import { latestVersionOfCommonTypesMustBeUsed } from "./functions/latest-version-of-common-types-must-be-used"
import locationMustHaveXmsMutability from "./functions/location-must-have-xms-mutability"
Expand Down Expand Up @@ -158,24 +157,6 @@ const ruleset: any = {
},
},

// RPC Code: RPC-Async-V1-07
LroLocationHeader: {
rpcGuidelineCode: "RPC-Async-V1-07",
description: "Location header must be supported for all async operations that return 202.",
message: "A 202 response should include an Location response header.",
severity: "error",
disableForTypeSpecDataPlane: true,
disableForTypeSpecDataPlaneReason: "Covered by TSP's '@azure-tools/typespec-azure-resource-manager/arm-location-header' rule.",
formats: [oas2],
given: "$.paths[*][*].responses[?(@property == '202')]",
then: {
function: hasheader,
functionOptions: {
name: "Location",
},
},
},

// RPC Code: RPC-Async-V1-11, RPC-Async-V1-14
PostResponseCodes: {
rpcGuidelineCode: "RPC-Async-V1-11, RPC-Async-V1-14",
Expand Down
Loading

0 comments on commit edb6559

Please sign in to comment.