[Swagger Linter Migration] EnumInsteadOfBoolean - #5265
Open
Yuchao Yan (msyyc) wants to merge 4 commits into
Open
[Swagger Linter Migration] EnumInsteadOfBoolean#5265Yuchao Yan (msyyc) wants to merge 4 commits into
Yuchao Yan (msyyc) wants to merge 4 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4c5815a0-1862-43b9-bbb2-dfbe08b7606e
Contributor
|
All changed packages have been documented.
Show changes
|
Contributor
📦 Package size report✅ No notable package size changes compared to the base branch. 13 package(s) with no notable change
Packed = gzipped |
commit: |
Contributor
|
You can try these changes here
|
Yuchao Yan (msyyc)
marked this pull request as ready for review
August 20, 2026 07:53
Yuchao Yan (msyyc)
requested review from
Mark Cowlishaw (markcowl),
Timothee Guerin (timotheeguerin) and
Jeff Fisher (xirzec)
as code owners
August 20, 2026 07:53
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8ed00e6d-dd0a-40f7-8871-ee32f0f371fb
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8ed00e6d-dd0a-40f7-8871-ee32f0f371fb
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.
Original Swagger linter
EnumInsteadOfBooleanSpecific checks promoted from the done lintdiff rule:
How the Swagger linter works
The Swagger rule is a Spectral rule from the common ruleset. It inspects emitted OpenAPI schema objects and reports schemas whose type is
boolean, with diagnostics located on the emitted schema path. The lintdiff migration evidence accepts that the Swagger and TypeSpec implementations run at different representation layers: Swagger can report repeated emitted schema copies, while the TypeSpec rule reports the authorable source target.Source TypeSpec lintdiff rule
Source branch:
feature/lintdiff-migration-newSource rule: https://github.com/Azure/typespec-azure/blob/feature/lintdiff-migration-new/packages/typespec-lintdiff/src/rules/enum-instead-of-boolean.ts
The source worktree had no uncommitted changes for the lintdiff source rule or
EnumInsteadOfBooleanfixture directory when this promotion was created. The user-marked done lintdiff source rule was not modified during promotion.Destination analysis
The rule belongs in
@azure-tools/typespec-azure-corebecause the lintdiff metadata marksEnumInsteadOfBooleanasapplicability: Bothwithsources: ["common"], and the local TypeSpec rule only depends on compiler/http APIs. It does not inspect ARM resources, provider namespaces, ARM resource paths, ARM lifecycle operations, or ARM envelopes.Because the rule applies to both ARM and data-plane specs, this PR enables
@azure-tools/typespec-azure-core/enum-instead-of-booleanin bothtypespec-azure-rulesetsdata-plane and resource-manager rulesets.How the promoted TypeSpec linter works
The promoted Azure Core rule preserves the done lintdiff rule behavior:
booleanscalar.getHttpOperationand reports boolean response bodies on the operation or authored body property target.Fixture-to-native test mapping
emits warning for boolean model propertiesemits warning for boolean path parametersemits warning for boolean request bodiesemits warning for boolean response bodiesallows comparable non-boolean shapesThe official package tests use direct TypeSpec snippets and expected diagnostics. Lintdiff harness snapshots were not copied.
Migration evidence
Migration evidence: https://github.com/Azure/typespec-azure/blob/feature/lintdiff-migration-new/packages/typespec-lintdiff/test/fixtures/EnumInsteadOfBoolean/migration.md
The detailed focused tests, real-service project comparison, corpus counts, one-sided project explanations, compile-failure handling, and remaining uncertainty are recorded there rather than duplicated in this PR description.
Promotion sync policy
Semantic gaps found after promotion should block the promotion PR until the user explicitly reopens lintdiff repair. This PR does not include unapproved source-rule edits in
packages/typespec-lintdiff.