Azure / Azure/azure-openapi-validator

R2008 erroneously fails when property narrows mutability from the base definition

Open
#248 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
53
Forks
57
Avg merge
1d 23h
Merged PRs (30d)
2

Description

PR in question: https://github.com/Azure/azure-rest-api-specs/pull/15439
LintDiff Gate: https://github.com/Azure/azure-rest-api-specs/pull/15439/checks?check_run_id=3344805888
Fails with: `When property is modeled as 'readOnly': true then x-ms-mutability extension can only have 'read' value. When property is modeled as 'readOnly': false then applying x-ms-mutability extension with only 'read' value is not allowed. Extension contains invalid values: 'read'.`

This was originally caught in https://github.com/Azure/azure-rest-api-specs/pull/12554#issuecomment-814225085. For example, [EnvironmentVersion.environmentType](https://github.com/Azure/azure-rest-api-specs/blob/a252d092926964d709021608e5e775a1b8b32ae9/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-10-01/mfe.json#L7213-L7220) is **correctly** marked as ReadOnly, with the correct x-ms-mutability extension. However, since [EnvironmentType](https://github.com/Azure/azure-rest-api-specs/blob/a252d092926964d709021608e5e775a1b8b32ae9/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2021-10-01/mfe.json#L7175-L7187) has a wider mutability scope, [R2008](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r2008) is erroneously thrown.

(originally posted in https://github.com/Azure/azure-rest-api-specs/issues/15666)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.