Skip to content

feat(examples): add examples-resolve tool - #5121

Draft
Timothee Guerin (timotheeguerin) wants to merge 1 commit into
examples-migratefrom
examples-resolve
Draft

feat(examples): add examples-resolve tool#5121
Timothee Guerin (timotheeguerin) wants to merge 1 commit into
examples-migratefrom
examples-resolve

Conversation

@timotheeguerin

Copy link
Copy Markdown
Member

Part of the Unified Examples Format epic (#4831), tracking #4834.

Stack

Top of the stack — review/merge after the two PRs below it. Targets examples-migrate, not main.

What

Adds the examples-resolve tool + examples-resolve CLI to @azure-tools/typespec-azure-examples, which resolves the applicable example for each operation at a target API version.

  • Per lineage, selects the entry with the greatest since <= target (base entry applies from the earliest version), using the linear service.yaml version order.
  • Materializes the {api-version} placeholder to the target version.
  • Errors on an unknown target version; omits lineages with no applicable entry.

Tests added (vitest); tsc, oxlint, prettier clean.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the stale Mark a PR that hasn't been recently updated and will be closed. label Aug 14, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown

Hi @Timothee Guerin (@timotheeguerin). Your PR has had no update for 14 days and it is marked as a stale PR. If it is not updated within 14 days, the PR will automatically be closed. If you want to refresh the PR, please remove the stale label.

@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @azure-tools/typespec-azure-examples
Show changes

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

Add the transitional tsp-examples-legacy-expand tool that expands the unified examples into the concrete example for each operation at a target API version (greatest since <= target per lineage, using the service.yaml order) and materializes the {api-version} placeholder.

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

Add the transitional tsp-examples-migrate tool that converts existing x-ms-examples JSON into the unified examples.yaml format (crawls versioned Swagger, normalizes {api-version}, dedups across versions into since lineages, and uses an adjacent service.yaml as the authoritative version list).

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

Add @azure-tools/typespec-azure-examples with the examples.yaml JSON Schema and the tsp-examples validate command for the unified examples format.

@pkg-pr-new

pkg-pr-new Bot commented Aug 31, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-azure-examples@5121

commit: 0a5c88b

@github-actions

Copy link
Copy Markdown
Contributor

📦 Package size report

1 package changed size, +732 B (+0.0%) packed overall.

Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/typespec-azure-examples 58.15 KB → 58.94 KB +809 B (+1.4%) 🔴 230.80 KB → 233.47 KB +2.67 KB (+1.2%) 🔴
13 package(s) with no notable change
Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/typespec-java 13.51 MB → 13.51 MB -43 B (-0.0%) 15.03 MB → 15.03 MB
@azure-tools/typespec-azure-core 130.25 KB → 130.22 KB -27 B (-0.0%) 706.89 KB → 706.76 KB -135 B (-0.0%)
@azure-tools/azure-http-specs 146.71 KB → 146.71 KB -4 B (-0.0%) 1.16 MB → 1.16 MB
@azure-tools/typespec-azure-portal-core 42.40 KB → 42.40 KB -4 B (-0.0%) 192.91 KB → 192.91 KB
@azure-tools/typespec-ts 536.71 KB → 536.71 KB +1 B (+0.0%) 2.58 MB → 2.58 MB
@azure-tools/typespec-autorest 80.93 KB → 80.93 KB 395.06 KB → 395.06 KB
@azure-tools/typespec-autorest-canonical 7.42 KB → 7.42 KB 26.00 KB → 26.00 KB
@azure-tools/typespec-azure-resource-manager 171.92 KB → 171.92 KB 1.04 MB → 1.04 MB
@azure-tools/typespec-azure-rulesets 5.16 KB → 5.16 KB 32.09 KB → 32.09 KB
@azure-tools/typespec-client-generator-core 229.48 KB → 229.48 KB 1.23 MB → 1.23 MB
@azure-tools/typespec-go 260.21 KB → 260.21 KB 1.33 MB → 1.33 MB
@azure-tools/typespec-metadata 15.91 KB → 15.91 KB 62.26 KB → 62.26 KB
@azure-tools/typespec-python 42.22 KB → 42.22 KB 164.91 KB → 164.91 KB

Packed = gzipped .tgz published to npm. Unpacked = total extracted size. 🆕 added, 🗑️ removed. Packages from the core/ submodule are not included.
🔴 grew · 🟢 shrank — only changes of at least 512 B and 0.5% are marked.

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

Labels

stale Mark a PR that hasn't been recently updated and will be closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant