Skip to content

Add union extends HTTP spec scenarios - #11957

Draft
Weidong Xu (weidongxu-microsoft) wants to merge 4 commits into
microsoft:mainfrom
weidongxu-microsoft:feature/http-spec-union-extends
Draft

Weidong Xu (weidongxu-microsoft) wants to merge 4 commits into
microsoft:mainfrom
weidongxu-microsoft:feature/http-spec-union-extends

Conversation

@weidongxu-microsoft

@weidongxu-microsoft Weidong Xu (weidongxu-microsoft) commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add three HTTP spec round-trip scenarios for union extends in the same test
  • cover structurally compatible variants, explicit model inheritance, and multiple base constraints
  • make Spector scenario validation honor project tspconfig.yaml feature settings

Validation

  • pnpm --filter @typespec/http-specs build
  • pnpm --filter @typespec/http-specs validate-mock-apis
  • pnpm --filter @typespec/spector test
  • targeted type-aware lint for changed Spector sources

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

Copilot-Session: ac3c4495-6450-418b-b0e1-154a545aef63
@microsoft-github-policy-service microsoft-github-policy-service Bot added lib:http-specs For issues/prs related to the @typespec/http-specs package spector Issues related to spector and the spec sets labels Sep 14, 2026
@pkg-pr-new

pkg-pr-new Bot commented Sep 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-specs@11957
npm i https://pkg.pr.new/@typespec/spector@11957

commit: f1a25dc

@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @typespec/http-specs
  • @typespec/spector
Show changes

@typespec/http-specs - feature ✏️

Add a round-trip scenario for unions constrained to common base types.

@typespec/spector - fix ✏️

Honor project tspconfig.yaml settings when validating scenarios and mock APIs.

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

Copilot-Session: ac3c4495-6450-418b-b0e1-154a545aef63
@weidongxu-microsoft Weidong Xu (weidongxu-microsoft) changed the title Add union extends HTTP spec scenario Add union extends HTTP spec scenarios Sep 14, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ac3c4495-6450-418b-b0e1-154a545aef63
@weidongxu-microsoft

Copy link
Copy Markdown
Contributor Author

@azure-sdk-automation

azure-sdk-automation Bot commented Sep 14, 2026

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

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

Copilot-Session: ac3c4495-6450-418b-b0e1-154a545aef63
Comment on lines +69 to +77
union MultiplePetWithName extends MultipleNameBase {
cat: MultipleCat,
dog: MultipleDog,
}

union MultiplePetWithFood extends MultipleFoodBase {
cat: MultipleCat,
dog: MultipleDog,
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

they have different base class

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

Labels

lib:http-specs For issues/prs related to the @typespec/http-specs package spector Issues related to spector and the spec sets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant