Skip to content

Commit

Permalink
Update logic to check for the property name and not description
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilailla committed Jan 23, 2025
1 parent f6d917e commit 6574beb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions packages/rulesets/generated/spectral/az-arm.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ function getRequiredProperties(schema) {
});
}
if (schema.required) {
requires = [...schema.required, ...requires];
requires = [...schema.required, requires];
}
return requires;
}
Expand Down Expand Up @@ -2040,14 +2040,14 @@ const patchBodyParameters = (parameters, _opts, paths) => {
if (parameters === null || parameters.schema === undefined || parameters.in !== "body") {
return [];
}
if (parameters.schema.description && parameters.schema.description.includes("Managed service identity")) {
return [];
}
const path = paths.path || [];
const properties = getProperties(parameters.schema);
const requiredProperties = getRequiredProperties(parameters.schema);
const errors = [];
for (const prop of Object.keys(properties)) {
if (prop.toLowerCase() === "identity") {
continue;
}
if (properties[prop].default) {
errors.push({
message: `Properties of a PATCH request body must not have default value, property:${prop}.`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ const patchBodyParameters = (parameters: any, _opts: any, paths: any): IFunction
return []
}

// skip validation for MSI(managed service identity),
// as it is being referenced from common-types
if (parameters.schema.description && parameters.schema.description.includes("Managed service identity")) {
return []
}

const path = paths.path || []

const properties: object = getProperties(parameters.schema)
const requiredProperties = getRequiredProperties(parameters.schema)
const errors = []
for (const prop of Object.keys(properties)) {
// skip validation for identity property
// as it refers MSI(managed service identity) from common-types
if (prop.toLowerCase() === "identity") {
continue
}

if (properties[prop].default) {
errors.push({
message: `Properties of a PATCH request body must not have default value, property:${prop}.`,
Expand Down

0 comments on commit 6574beb

Please # to comment.