Open
Description
In developing the fix for Azure/azure-sdk-tools#6840, we discovered that the special logic in lib/swaggerValidator/ajvSchemaValidator.ts
for x-ms-mutability
doesn't work when that property is a sibling of "$ref".
https://github.com/Azure/oav/blob/develop/lib/swaggerValidator/ajvSchemaValidator.ts#L288
// If a response has x-ms-mutability property and its missing the read we can skip this error
if (
cxt.isResponse &&
((keyword === "required" &&
(parentSchema.properties?.[(params as any).missingProperty]?.[xmsMutability]?.indexOf(
"read"
) === -1 ||
// required check is ignored when x-ms-secret is true
(parentSchema.properties?.[(params as any).missingProperty] as any)?.[xmsSecret] ===
true)) ||
(keyword === "type" && data === null && parentSchema[xmsMutability]?.indexOf("read") === -1))
) {
return true;
}
Autorest allows some properties to be siblings of $ref, and specifically any "x-" properties.
https://github.com/Azure/autorest/blob/main/docs/openapi/howto/%24ref-siblings.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels