Azure / Azure/typespec-azure

Add linting rule that prevents adding ArmTagsProperty to TrackedResource

Open
#542 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
27
Forks
90
Avg merge
1d 22h
Merged PRs (30d)
156

Description

Add linting rule that prevents adding `ArmTagsProperty` to `TrackedResource`. This TypeSpec:

```
model PrivateCloud is TrackedResource {
...ArmTagsProperty;
```

Generates this swagger:

```
"PrivateCloud": {
"properties": {
"tags": {
"type": "object",
"description": "Resource tags.",
"additionalProperties": {
"type": "string"
}
},
},
"allOf": [
{
"$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/TrackedResource"
}
]

"TrackedResource": {
"title": "Tracked Resource",
"description": "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'",
"type": "object",
"properties": {
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"x-ms-mutability": [
"read",
"create",
"update"
],
"description": "Resource tags."
},
```

Which fails [Breaking Change(Cross-Version)](https://github.com/Azure/azure-rest-api-specs-pr/pull/17544/checks?check_run_id=22852786355) since the `tags.x-ms-mutability` properties differ.

## Example

https://github.com/Azure/azure-rest-api-specs/blob/6fc313ed7a6e926d4409d4ddb435f6532922652f/specification/vmware/Microsoft.AVS/models.tsp#L549-L550

https://github.com/Azure/azure-rest-api-specs/blob/6fc313ed7a6e926d4409d4ddb435f6532922652f/specification/common-types/resource-management/v5/types.json#L61-L72

https://github.com/Azure/azure-sdk-tools/issues/7917

Contributor guide

Open the contributing guide

Research direction

Start by examining the TypeSpec Azure linting rules and the tracked-resource example at specification/vmware/Microsoft.AVS/models.tsp#L549-L550. Compare it with specification/common-types/resource-management/v5/types.json#L61-L72, then add coverage showing that ArmTagsProperty on TrackedResource is rejected and verify the reported cross-version breaking change is prevented.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.