Skip to content

Move legacy API version override to Azure Core - #5176

Draft
Mark Cowlishaw (markcowl) wants to merge 6 commits into
Azure:mainfrom
markcowl:markcowl/azure-core-override-api-version
Draft

Move legacy API version override to Azure Core#5176
Mark Cowlishaw (markcowl) wants to merge 6 commits into
Azure:mainfrom
markcowl:markcowl/azure-core-override-api-version

Conversation

@markcowl

Copy link
Copy Markdown
Member

Summary

  • add \Azure.Core.Legacy.overrideApiVersion\ for namespace and interface API-version wire overrides
  • expose direct and inherited Azure Core accessors for namespaces, interfaces, and operations
  • update TCGC, AutoRest, TypeScript, and Go to consume the Azure Core override while preserving ARM feature-file version precedence

Validation

  • affected package builds
  • Azure Core, TCGC, ARM, AutoRest, TypeScript, and Go unit tests
  • TypeScript Spector integration tests
  • repository format and lint

@microsoft-github-policy-service microsoft-github-policy-service Bot added lib:azure-core Issues for @azure-tools/typespec-azure-core library lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library emitter:autorest Issues for @azure-tools/typespec-autorest emitter emitter:go Issues for @azure-tools/typespec-go emitter emitter:typescript Issues for @azure-tools/typespec-ts emitter lib:tcgc Issues for @azure-tools/typespec-client-generator-core library meta:website TypeSpec.io updates labels Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @azure-tools/typespec-autorest
  • @azure-tools/typespec-azure-core
  • @azure-tools/typespec-azure-resource-manager
  • @azure-tools/typespec-client-generator-core
  • @azure-tools/typespec-go
  • @azure-tools/typespec-ts
Show changes

@azure-tools/typespec-autorest - feature ✏️

Honor inherited Azure Core API-version overrides in emitted OpenAPI documents and warn when a document has inconsistent overrides.

@azure-tools/typespec-azure-resource-manager - feature ✏️

Add a version option to @featureFileOptions for overriding the generated client API version.

@azure-tools/typespec-go - feature ✏️

Generate Go clients with the opaque API-version default configured for each client.

@azure-tools/typespec-azure-core - feature ✏️

Add the legacy @Azure.Core.Legacy.overrideApiVersion decorator for overriding inherited and,> optionally language-scoped API-version wire defaults on namespaces and interfaces.,> ,> typespec,> @Azure.Core.Legacy.overrideApiVersion("2021-11-01"),> interface Widgets {,> get(): void;,> },>

@azure-tools/typespec-client-generator-core - feature ✏️

Populate per-client API-version defaults from Azure.Core.Legacy.overrideApiVersion for downstream emitters.

@azure-tools/typespec-ts - feature ✏️

Generate TypeScript clients with the opaque API-version default configured for each client.

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

You can try these changes here

🛝 Playground 🌐 Website

@pkg-pr-new

pkg-pr-new Bot commented Aug 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

@azure-tools/typespec-autorest

npm i https://pkg.pr.new/@azure-tools/typespec-autorest@5176

@azure-tools/typespec-azure-core

npm i https://pkg.pr.new/@azure-tools/typespec-azure-core@5176

@azure-tools/typespec-azure-resource-manager

npm i https://pkg.pr.new/@azure-tools/typespec-azure-resource-manager@5176

@azure-tools/typespec-client-generator-core

npm i https://pkg.pr.new/@azure-tools/typespec-client-generator-core@5176

@azure-tools/typespec-go

npm i https://pkg.pr.new/@azure-tools/typespec-go@5176

@azure-tools/typespec-ts

npm i https://pkg.pr.new/@azure-tools/typespec-ts@5176

commit: 54a2526

@markcowl
Mark Cowlishaw (markcowl) force-pushed the markcowl/azure-core-override-api-version branch from c964531 to c6b6218 Compare August 7, 2026 03:10
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f21ed198-f6d8-4a45-ab56-25dbec549540
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f21ed198-f6d8-4a45-ab56-25dbec549540
Validate root-client API version overrides while constructing the SDK package so TypeSpec validation does not eagerly build the client graph or duplicate unrelated diagnostics.

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

Copilot-Session: f21ed198-f6d8-4a45-ab56-25dbec549540
Keep client override validation in the TypeSpec validation hook, but determine explicit client ancestry directly from scoped decorator state so validation does not emit SDK graph diagnostics early or twice.

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

Copilot-Session: f21ed198-f6d8-4a45-ab56-25dbec549540
Add Azure.Core.Legacy.overrideApiVersion with inherited accessors and update TCGC and downstream emitters to consume the Azure Core metadata while preserving per-client opaque API-version defaults.

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

Copilot-Session: f21ed198-f6d8-4a45-ab56-25dbec549540
Document Azure.Core.Legacy.overrideApiVersion in the generated Azure Core decorator reference and index.

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

Copilot-Session: f21ed198-f6d8-4a45-ab56-25dbec549540
@markcowl
Mark Cowlishaw (markcowl) force-pushed the markcowl/azure-core-override-api-version branch from c6b6218 to 54a2526 Compare August 7, 2026 03:14
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📦 Package size report

8 packages changed size compared to the base branch.

Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/typespec-ts 524.67 KB → 525.79 KB +1.12 KB (+0.2%) 2.53 MB → 2.53 MB +5.23 KB (+0.2%)
@azure-tools/typespec-autorest 80.93 KB → 81.68 KB +774 B (+0.9%) 395.06 KB → 399.09 KB +4.03 KB (+1.0%)
@azure-tools/typespec-azure-core 130.76 KB → 131.44 KB +697 B (+0.5%) 709.33 KB → 713.41 KB +4.09 KB (+0.6%)
@azure-tools/typespec-azure-resource-manager 169.84 KB → 170.13 KB +299 B (+0.2%) 1.03 MB → 1.03 MB +2.34 KB (+0.2%)
@azure-tools/typespec-client-generator-core 225.96 KB → 226.16 KB +203 B (+0.1%) 1.22 MB → 1.22 MB +1009 B (+0.1%)
@azure-tools/typespec-go 242.34 KB → 242.51 KB +170 B (+0.1%) 1.24 MB → 1.24 MB +821 B (+0.1%)
@azure-tools/typespec-java 13.50 MB → 13.50 MB -107 B (-0.0%) 15.02 MB → 15.02 MB
@azure-tools/typespec-azure-portal-core 42.26 KB → 42.26 KB -2 B (-0.0%) 192.36 KB → 192.37 KB +4 B (+0.0%)
37 unchanged package(s)
Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/azure-http-specs 146.21 KB → 146.21 KB 1.16 MB → 1.16 MB
@azure-tools/typespec-autorest-canonical 7.42 KB → 7.42 KB 26.00 KB → 26.00 KB
@azure-tools/typespec-azure-rulesets 5.15 KB → 5.15 KB 31.73 KB → 31.73 KB
@azure-tools/typespec-metadata 15.91 KB → 15.91 KB 62.26 KB → 62.26 KB
@azure-tools/typespec-python 46.22 KB → 46.22 KB 180.83 KB → 180.83 KB
@typespec/asset-emitter 33.73 KB → 33.73 KB 158.67 KB → 158.67 KB
@typespec/bundler 11.31 KB → 11.31 KB 41.97 KB → 41.97 KB
@typespec/compiler 761.02 KB → 761.02 KB 3.87 MB → 3.87 MB
@typespec/emitter-framework 273.89 KB → 273.89 KB 1.50 MB → 1.50 MB
@typespec/events 8.95 KB → 8.95 KB 34.97 KB → 34.97 KB
@typespec/graphql 130.78 KB → 130.78 KB 542.97 KB → 542.97 KB
@typespec/html-program-viewer 53.96 KB → 53.96 KB 218.99 KB → 218.99 KB
@typespec/http 103.62 KB → 103.62 KB 509.38 KB → 509.38 KB
@typespec/http-canonicalization 74.34 KB → 74.34 KB 479.47 KB → 479.47 KB
@typespec/http-client 56.37 KB → 56.37 KB 281.14 KB → 281.14 KB
@typespec/http-client-js 219.98 KB → 219.98 KB 1.06 MB → 1.06 MB
@typespec/http-server-csharp 100.03 KB → 100.03 KB 407.41 KB → 407.41 KB
@typespec/http-server-js 259.11 KB → 259.11 KB 1.27 MB → 1.27 MB
@typespec/http-specs 182.16 KB → 182.16 KB 1.26 MB → 1.26 MB
@typespec/json-schema 31.02 KB → 31.02 KB 152.61 KB → 152.61 KB
@typespec/library-linter 4.35 KB → 4.35 KB 12.71 KB → 12.71 KB
@typespec/mutator-framework 71.94 KB → 71.94 KB 462.87 KB → 462.87 KB
@typespec/openapi 20.62 KB → 20.62 KB 91.67 KB → 91.67 KB
@typespec/openapi3 160.85 KB → 160.85 KB 823.92 KB → 823.92 KB
@typespec/playground 59.09 KB → 59.09 KB 239.02 KB → 239.02 KB
@typespec/prettier-plugin-typespec 157.12 KB → 157.12 KB 816.92 KB → 816.92 KB
@typespec/protobuf 94.30 KB → 94.30 KB 400.13 KB → 400.13 KB
@typespec/rest 24.22 KB → 24.22 KB 126.40 KB → 126.40 KB
@typespec/spec-api 46.56 KB → 46.56 KB 210.05 KB → 210.05 KB
@typespec/spec-coverage-sdk 41.84 KB → 41.84 KB 190.92 KB → 190.92 KB
@typespec/spector 138.83 KB → 138.83 KB 587.36 KB → 587.36 KB
@typespec/sse 5.66 KB → 5.66 KB 19.01 KB → 19.01 KB
@typespec/streams 4.12 KB → 4.12 KB 12.47 KB → 12.47 KB
@typespec/tspd 97.82 KB → 97.82 KB 430.99 KB → 430.99 KB
@typespec/versioning 36.69 KB → 36.69 KB 201.84 KB → 201.84 KB
@typespec/xml 9.41 KB → 9.41 KB 39.14 KB → 39.14 KB
tmlanguage-generator 5.00 KB → 5.00 KB 15.32 KB → 15.32 KB

Packed = gzipped .tgz published to npm. Unpacked = total extracted size. 🆕 added, 🗑️ removed.

export function getApiVersionOverride(
program: Program,
target: Namespace | Interface,
emitterName?: string,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No Azure Core decorators have scope. Shall we remove the emitterName?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You do not need to add new param in TCGC. Just change the logic inner updateWithApiVersionInformation and all emitters could get transparent value for this.

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

Labels

emitter:autorest Issues for @azure-tools/typespec-autorest emitter emitter:go Issues for @azure-tools/typespec-go emitter emitter:typescript Issues for @azure-tools/typespec-ts emitter lib:azure-core Issues for @azure-tools/typespec-azure-core library lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library lib:tcgc Issues for @azure-tools/typespec-client-generator-core library meta:website TypeSpec.io updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants