From 48bea5ebb6a161ed89824cde2d70ffead05d2132 Mon Sep 17 00:00:00 2001 From: laxmankumar12 Date: Fri, 6 Jan 2023 10:56:21 -0800 Subject: [PATCH] Validate provisioning state only if azure resource --- .../native/legacyRules/Rpaas_ResourceProvisioningState.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/rulesets/src/native/legacyRules/Rpaas_ResourceProvisioningState.ts b/packages/rulesets/src/native/legacyRules/Rpaas_ResourceProvisioningState.ts index d71c86d73..79a97e1aa 100644 --- a/packages/rulesets/src/native/legacyRules/Rpaas_ResourceProvisioningState.ts +++ b/packages/rulesets/src/native/legacyRules/Rpaas_ResourceProvisioningState.ts @@ -22,14 +22,16 @@ rules.push({ const allResources = utils.getAllResourceNames() for (const resource of allResources) { const model = utils.getResourceByName(resource) + const azureResource = swaggerUtil?.getProperty(model!, "x-ms-azure-resource") const properties = swaggerUtil?.getProperty(model!, "properties") + const isAzureResource = azureResource && azureResource.value let hasProvisioningState = false - if (properties && (!properties.value.type || properties.value.type === "object")) { + if (isAzureResource && properties && (!properties.value.type || properties.value.type === "object")) { if (swaggerUtil?.getProperty(properties, "provisioningState")) { hasProvisioningState = true } } - if (!hasProvisioningState) { + if (isAzureResource && !hasProvisioningState) { yield { message: msg.replace("{0}", resource), location: ["$", "definitions", resource] as JsonPath } } }