Skip to content

Validate unified examples against API contracts and preserve parameter locations - #5799

Draft
Timothee Guerin (timotheeguerin) wants to merge 11 commits into
Azure:release/october-2026from
timotheeguerin:fix/examples-parameter-refs
Draft

Timothee Guerin (timotheeguerin) wants to merge 11 commits into
Azure:release/october-2026from
timotheeguerin:fix/examples-parameter-refs

Conversation

@timotheeguerin

@timotheeguerin Timothee Guerin (timotheeguerin) commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Unified examples can currently validate successfully even when values do not match the API, and a misspelled operation can silently lose its example during compilation.

tsp-examples validate <project> now compiles the current TypeSpec/AutoRest HTTP contract in memory and checks request/response values with the existing JSON Schema validator. Errors include the API version, offending value path, and YAML location. No generated files are overwritten.

Unknown applicable operation keys are errors during both validation and AutoRest compilation. External Swagger parameter references are resolved before migrating locations or expanding body parameter names, eliminating the manual path-parameter repairs needed by every ARM pilot.

Command behavior change: API validation requires main.tsp and the project's installed compiler/AutoRest emitter. Use --schema-only for format-only folders or the previous check. The pure/browser validation APIs remain format-only and unchanged.

Fixes #5793, #5795, and #5796.

Targets release/october-2026; contributor documentation is kept in a separate main PR. Real Purview validation succeeds in strict mode; Community Training now correctly identifies its existing undeclared LRO response header.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

❌ There is undocummented changes. Run chronus add to add a changeset or click here.

The following packages have changes but are not documented.

  • ❌@azure-tools/typespec-java
  • ❌@azure-tools/typespec-ts

The following packages have already been documented:

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

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

Resolve local and external Swagger parameter references before migrating request locations, preserving path parameters and each API version's body names. Report missing or circular references explicitly.

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

Validate example request and response values against the current TypeSpec API, with API-version and YAML-location diagnostics. Use --schema-only for format-only validation.,> ,> sh,> tsp-examples validate path/to/project,>

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

Report an error at the source YAML when an applicable unified example references an operation that does not exist in the emitted API version.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

📦 Package size report

2 packages changed size, +7.26 KB (+0.0%) packed overall.

Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/typespec-azure-examples 72.99 KB → 79.63 KB +6.64 KB (+9.1%) 🔴 359.83 KB → 410.00 KB +50.17 KB (+13.9%) 🔴
@azure-tools/typespec-autorest 87.87 KB → 88.49 KB +635 B (+0.7%) 🔴 424.17 KB → 427.62 KB +3.45 KB (+0.8%) 🔴
12 package(s) with no notable change
Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/azure-http-specs 143.50 KB → 143.50 KB — 1.20 MB → 1.20 MB —
@azure-tools/typespec-autorest-canonical 7.42 KB → 7.42 KB — 26.00 KB → 26.00 KB —
@azure-tools/typespec-azure-core 134.23 KB → 134.23 KB — 724.20 KB → 724.20 KB —
@azure-tools/typespec-azure-portal-core 36.26 KB → 36.26 KB — 242.62 KB → 242.62 KB —
@azure-tools/typespec-azure-resource-manager 184.13 KB → 184.13 KB — 1.11 MB → 1.11 MB —
@azure-tools/typespec-azure-rulesets 5.50 KB → 5.50 KB — 33.69 KB → 33.69 KB —
@azure-tools/typespec-client-generator-core 241.87 KB → 241.87 KB — 1.29 MB → 1.29 MB —
@azure-tools/typespec-go 263.66 KB → 263.66 KB — 1.35 MB → 1.35 MB —
@azure-tools/typespec-java 20.22 MB → 20.22 MB — 22.52 MB → 22.52 MB —
@azure-tools/typespec-metadata 15.91 KB → 15.91 KB — 62.26 KB → 62.26 KB —
@azure-tools/typespec-python 42.21 KB → 42.21 KB — 164.90 KB → 164.90 KB —
@azure-tools/typespec-ts 550.46 KB → 550.46 KB — 2.75 MB → 2.75 MB —

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.

@pkg-pr-new

pkg-pr-new Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/typespec-autorest@5799
npm i https://pkg.pr.new/@azure-tools/typespec-azure-examples@5799
npm i https://pkg.pr.new/@azure-tools/typespec-java@5799
npm i https://pkg.pr.new/@azure-tools/typespec-ts@5799

commit: 86520e6

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

You can try these changes here

🛝 Playground 🌐 Website

@timotheeguerin Timothee Guerin (timotheeguerin) changed the title fix(examples): preserve referenced parameter locations in migration Validate unified examples against API contracts and preserve parameter locations Oct 21, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:autorest Issues for @azure-tools/typespec-autorest emitter label Oct 21, 2026

This branch has not been deployed

No deployments
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant