Add arm-no-replace-inherited-props linting rule#4384
Draft
Conversation
Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/65193dd6-7c37-41ac-849e-a574be60d7c0 Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add ARM linting rule to prevent repeating inherited properties
Add arm-no-replace-inherited-props linting rule
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Redefining a property already declared on a base model is an Azure API anti-pattern and currently crashes the breaking-change tool (see azure-rest-api-specs#42903). This PR adds a new ARM linter rule to flag the pattern at design time.
Changes
arm-no-replace-inherited-props(packages/typespec-azure-resource-manager/src/rules/arm-no-replace-inherited-props.ts)baseModelchain; emits a warning for any property in the current model whose name also appears in any ancestor.nameproperty of an ARM resource, and any property whose name matches a discriminator declared via@discriminatoron an ancestor.The property '${propertyName}' is also defined in the base model. Redefining inherited properties can cause problems with OpenAPI tooling and some language representations of the models.src/linter.ts(included in theallruleset).nameexemption, discriminator exemption, and that non-discriminator properties under a@discriminatorbase are still reported.linter.mdreference and packageREADME.md..chronus/changes/.Example