[Swagger Linter Migration] TagsAreNotAllowedForProxyResources (origin) - #5406
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The newly added migration analysis contains a future-dated run timestamp, which should be corrected/removed to keep the evidence timeline accurate.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Migrates/aligns the TagsAreNotAllowedForProxyResources Swagger validator behavior into the local TypeSpec LintDiff rule by expanding detection to include proxy resource envelope tags (in addition to properties bag tags), and adds fixture + migration evidence to validate the intended equivalence scope (including http-reachable projection alignment).
Changes:
- Update the TypeSpec rule to flag
tagson proxy resource envelopes as well as in their properties models. - Add/refresh fixture cases covering: proxy w/ tags, proxy w/ envelope tags, proxy w/o tags, and tracked resource w/ supported tags.
- Add migration analysis documentation and align fixture metadata with
projectionScope: http-reachable.
File summaries
| File | Description |
|---|---|
| packages/typespec-lintdiff/src/rules/tags-are-not-allowed-for-proxy-resources.ts | Extends the rule to detect tags on the proxy resource model (envelope) in addition to the properties model. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/rule.md | Updates fixture metadata (projectionScope: http-reachable) and documents expanded envelope+bag coverage plus new fixture IDs. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/migration.md | Adds detailed migration/equivalence analysis and corpus comparison evidence. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/proxy-with-tags/tsp-diagnostics.json | Updates expected TypeSpec diagnostics to match the revised rule messaging and current ambient lint set. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/proxy-without-tags/validator-diagnostics.json | Adds validator diagnostic snapshot for a clean proxy control case. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/proxy-without-tags/tsp-diagnostics.json | Adds TypeSpec diagnostic snapshot for a clean proxy control case. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/proxy-without-tags/output.json | Adds emitted OpenAPI snapshot for the clean proxy control case. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/proxy-without-tags/main.tsp | Adds TypeSpec source for the clean proxy control case. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/proxy-without-tags/expect.json | Adds harness expectation for the clean proxy control case. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/proxy-with-envelope-tags/validator-diagnostics.json | Adds validator diagnostic snapshot for the envelope-tags violation case. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/proxy-with-envelope-tags/tsp-diagnostics.json | Adds TypeSpec diagnostic snapshot for the envelope-tags violation case. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/proxy-with-envelope-tags/output.json | Adds emitted OpenAPI snapshot demonstrating envelope-level tags emission. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/proxy-with-envelope-tags/main.tsp | Adds TypeSpec source that authors tags directly on a proxy resource envelope. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/proxy-with-envelope-tags/expect.json | Adds harness expectation for the envelope-tags violation case. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/tracked-with-tags/validator-diagnostics.json | Adds validator diagnostic snapshot for a tracked-resource control case. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/tracked-with-tags/tsp-diagnostics.json | Adds TypeSpec diagnostic snapshot for the tracked-resource control case. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/tracked-with-tags/output.json | Adds emitted OpenAPI snapshot for the tracked-resource control case. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/tracked-with-tags/main.tsp | Adds TypeSpec source for the tracked-resource control case. |
| packages/typespec-lintdiff/test/fixtures/TagsAreNotAllowedForProxyResources/tracked-with-tags/expect.json | Adds harness expectation for the tracked-resource control case. |
Review details
- Files reviewed: 19/19 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Original Swagger linter
The staging-only Swagger rule visits every definition's
propertiesobject and:properties.tagswhen the same object does not containlocation;propertiesvalue for the firsttagskey;The absence-of-
locationheuristic does not establish that a definition is a proxy resource. It therefore also flags tracked-resource update envelopes and arbitrary models; the migration does not reproduce those validator defects.Migrated TypeSpec linter
The rule uses
getArmResources(program)and limits evaluation to resources whose ARM kind isProxy. It checks both the resource envelope and its resource-specific properties model for authored or inheritedtags, reports on the offendingModelProperty, and naturally deduplicates emitted occurrences at the semantic resource/property level.projectionScope: http-reachablealigns corpus comparison with the Swagger version selected by the dataset.This closes the previous envelope gap while retaining the properties-bag check. Focused fixtures cover envelope and properties-bag violations, a tag-free proxy, and a tracked resource with supported tags.
Migration evidence
See migration.md for fixture snapshots, the full 462/468-project run, staging comparison, complete overlap and one-sided project sets, version-projection evidence, compile failures, emission matrix, and code-backed explanations of intentional validator-only findings.