Skip to content

[Swagger Linter Migration] TagsAreNotAllowedForProxyResources (origin) - #5406

Draft
Yuchao Yan (msyyc) wants to merge 1 commit into
Azure:feature/lintdiff-migration-newfrom
msyyc:feature/lintdiff-tags-are-not-allowed-for-proxy-resources
Draft

[Swagger Linter Migration] TagsAreNotAllowedForProxyResources (origin)#5406
Yuchao Yan (msyyc) wants to merge 1 commit into
Azure:feature/lintdiff-migration-newfrom
msyyc:feature/lintdiff-tags-are-not-allowed-for-proxy-resources

Conversation

@msyyc

Copy link
Copy Markdown
Member

Original Swagger linter

The staging-only Swagger rule visits every definition's properties object and:

  • reports properties.tags when the same object does not contain location;
  • searches beneath a nested properties value for the first tags key;
  • reports at the emitted JSON path it selected.

The absence-of-location heuristic 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 is Proxy. It checks both the resource envelope and its resource-specific properties model for authored or inherited tags, reports on the offending ModelProperty, and naturally deduplicates emitted occurrences at the semantic resource/property level. projectionScope: http-reachable aligns 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.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 tags on 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants