Skip to content

Preserve example payload order during migration - #5811

Merged
Timothee Guerin (timotheeguerin) merged 1 commit into
Azure:release/october-2026from
timotheeguerin:fix/examples-payload-order
Oct 22, 2026
Merged

Timothee Guerin (timotheeguerin) merged 1 commit into
Azure:release/october-2026from
timotheeguerin:fix/examples-payload-order

Conversation

@timotheeguerin

Copy link
Copy Markdown
Member

Migrating examples should not shuffle payload fields in the generated JSON. Deduplication currently collapses versions whose values match but whose field order differs, and response mapping always puts headers before the body.

Preserve the original request/response payload order, including nested objects and array items, and keep a since variant when only ordering changes. No YAML metadata, schema changes, or dependencies are added.

This is the standalone ordering fix, separated from #5799. Targets release/october-2026.

@github-actions

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-autorest
  • ❌@azure-tools/typespec-java
  • ❌@azure-tools/typespec-ts

The following packages have already been documented:

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

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

Preserve request and response payload field order during migration. Retain version-specific variants when only field order changes, including nested objects and array items, and keep response body and headers in their original order.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Package size report

✅ No notable package size changes compared to the base branch.

14 package(s) with no notable change
Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/typespec-azure-examples 62.67 KB → 62.55 KB -126 B (-0.2%) 309.28 KB → 308.68 KB -605 B (-0.2%)
@azure-tools/azure-http-specs 143.50 KB → 143.50 KB — 1.20 MB → 1.20 MB —
@azure-tools/typespec-autorest 87.87 KB → 87.87 KB — 424.17 KB → 424.17 KB —
@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 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 8c33b24

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

You can try these changes here

🛝 Playground 🌐 Website

@timotheeguerin
Timothee Guerin (timotheeguerin) merged commit fa93e0e into Azure:release/october-2026 Oct 22, 2026
44 checks passed
@timotheeguerin
Timothee Guerin (timotheeguerin) deleted the fix/examples-payload-order branch October 22, 2026 16:50
Timothee Guerin (timotheeguerin) added a commit that referenced this pull request Oct 22, 2026
…r locations (#5799)

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, including required and typed server parameters,
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.

Payload-order preservation is isolated in
#5811 so it can be reviewed
and released independently.

Targets `release/october-2026`; contributor documentation is kept off
the release branch. Strict validation exposes pre-existing pilot data
issues: Commerce's string-valued `showDetails`, Community Training's
undeclared LRO header, and Schema Registry's server parameter name and
undeclared response header. These need explicit data/API repairs rather
than silently rewriting examples.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Timothee Guerin (timotheeguerin) added a commit that referenced this pull request Oct 22, 2026
The unified-example fixes are merged but not yet available in the
October packages. Prepare these patch releases from
`release/october-2026`:

| Package | Version |
| --- | --- |
| `@azure-tools/typespec-autorest` | `0.73.1` → `0.73.2` |
| `@azure-tools/typespec-azure-examples` | `0.2.1` → `0.2.2` |

Ships #5799 and
#5811: API-aware validation,
unknown-operation errors, referenced parameter locations, and
payload-order preservation. `tsp-examples validate` now checks API
compatibility by default; `--schema-only` retains the previous
format-only check.

Release metadata only. SDK reader release/adoption is separate. After
publishing, backmerge the release branch into `main`.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants