Skip to content

Commit

Permalink
Add staging only
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilailla committed Sep 17, 2024
1 parent cd7f07f commit d7fc645
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
6 changes: 2 additions & 4 deletions packages/rulesets/generated/spectral/az-arm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2692,10 +2692,7 @@ const queryParametersInCollectionGet = (pathItem, _opts, ctx) => {
const GET = "get";
const errors = [];
for (const uri of uris) {
if (!pathItem[uri][GET]) {
continue;
}
if (isListOperation(uri)) {
if (pathItem[uri][GET] && isListOperation(uri)) {
const params = pathItem[uri][GET]["parameters"];
const queryParams = params === null || params === void 0 ? void 0 : params.filter((param) => param.in === "query" && param.name !== "api-version" && param.name !== "$filter");
queryParams === null || queryParams === void 0 ? void 0 : queryParams.forEach((param) => {
Expand Down Expand Up @@ -3493,6 +3490,7 @@ const ruleset = {
description: "Collection Get's/List operations MUST not have query parameters other than api-version & OData filter.",
severity: "error",
message: "{{error}}",
stagingOnly: true,
resolved: true,
formats: [oas2],
given: "$[paths,'x-ms-paths']",
Expand Down
1 change: 1 addition & 0 deletions packages/rulesets/src/spectral/az-arm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ const ruleset: any = {
description: "Collection Get's/List operations MUST not have query parameters other than api-version & OData filter.",
severity: "error",
message: "{{error}}",
stagingOnly: true,
resolved: true,
formats: [oas2],
given: "$[paths,'x-ms-paths']",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ export const queryParametersInCollectionGet = (pathItem: any, _opts: any, ctx: a
const errors: any[] = []

for (const uri of uris) {
// skip, if GET op isn't defined
if (!pathItem[uri][GET]) {
continue
}
// check if the GET op is a collection get/list call
if (isListOperation(uri)) {
//check if GET op is defined & the GET op is a collection get/list call
if (pathItem[uri][GET] && isListOperation(uri)) {
const params = pathItem[uri][GET]["parameters"]
const queryParams = params?.filter(
(param: { in: string; name: string }) => param.in === "query" && param.name !== "api-version" && param.name !== "$filter",
Expand Down

0 comments on commit d7fc645

Please sign in to comment.