[Swagger Linter Migration] EnumInsteadOfBoolean - #5265
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4c5815a0-1862-43b9-bbb2-dfbe08b7606e
|
All changed packages have been documented.
Show changes
|
📦 Package size report✅ No notable package size changes compared to the base branch. 13 package(s) with no notable change
Packed = gzipped |
commit: |
|
You can try these changes here
|
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
Co-authored-by: catalinaperalta <9859037+catalinaperalta@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4bddb07b-39e4-4a54-862d-a91d78e979db
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4bddb07b-39e4-4a54-862d-a91d78e979db
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4bddb07b-39e4-4a54-862d-a91d78e979db
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4bddb07b-39e4-4a54-862d-a91d78e979db
|
Timothee Guerin (@timotheeguerin) Thanks for your review and I updated the PR with your suggestions. Pls take a review again when spare. |
Original Swagger linter
Specific 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.