Skip to content

Order blueprint parameters and methods by name - #308

Merged
razor-x merged 1 commit into
mainfrom
claude/blueprint-normalize-ordering-bbvsrd
Aug 26, 2026
Merged

Order blueprint parameters and methods by name#308
razor-x merged 1 commit into
mainfrom
claude/blueprint-normalize-ordering-bbvsrd

Conversation

@razor-x

@razor-x razor-x commented Aug 26, 2026

Copy link
Copy Markdown
Member

Sorts request parameters (at every nesting levelcreateParameters recurses into object properties) and request methods by name, so the blueprint no longer depends on the order the OpenAPI spec happened to use.

Why that order is incidental today

Body properties reach blueprint as object keys; query parameters reach it as an array. seam-connect serializes its spec with json-stringify-deterministic, which sorts object keys but cannot sort array elements. So a body-described endpoint arrives alphabetically and a query-described one arrives in declaration order:

/access_codes/delete
  body properties (old): access_code_id, device_id, sync      ← alphabetical
  query parameters (new): device_id, access_code_id, sync     ← declaration order

Same endpoint, same parameters, different order — purely because of which representation describes it.

This commit changes no content

Regenerating the seam-blueprint snapshot against the same @seamapi/types@1.1040.0:

Lines changed 1,846 added / 1,846 removed
Lines appearing on both sides (pure movement) 1,846 → 100%
Lines genuinely added 0
Lines genuinely removed 0

Verified by comparing the added and removed line multisets. It is a permutation of existing output, nothing more.

What it makes reviewable

The point is the next PR. Bumping to the semantic-method spec (#306) currently churns the snapshot by 1,608/1,584 lines, of which only 46 are real content. Measured on top of this commit, the same bump becomes:

snapshot diff real content
#306 today 1,608 / 1,584 35 added, 11 removed
#306 on this base 37 / 13 35 added, 11 removed

Same real change, ~97% less noise — the diff becomes the change.

One test expectation moves with the output

createBlueprint: allows more than two methods on exempt endpoints asserted ['POST', 'PATCH', 'PUT'], which is the order its fixture inserted the pathItem keys in. It now asserts ['PATCH', 'POST', 'PUT'].

I changed that expectation because I deliberately changed the output ordering — flagging it rather than burying it. The test is about a three-method endpoint being allowed rather than rejected by the pathsAllowedMoreThanTwoMethods guard, which it still covers. semanticMethod and preferredMethod remain separate explicit fields, so sorting the array loses no information about which method to prefer.

Consumer-visible effect

Parameter order in generated docs/SDK output becomes guaranteed alphabetical. 310 of 318 endpoints were already alphabetical (via the object-key sorting described above), so this affects the 8 that were not — those whose parameters came from a oneOf/allOf branch flattening, e.g. /access_grants/create.

Checks

  • npm test78/78 pass
  • npm run typecheck — clean
  • npm run lint — clean

🤖 Generated with Claude Code

https://claude.ai/code/session_01UgJLypfYKgaoAYq7fKy4fs


Generated by Claude Code

Sorts request parameters (at every nesting level, since createParameters
recurses into object properties) and request methods by name, so the blueprint
no longer depends on the order the OpenAPI spec happened to use.

That order is incidental today. Body properties reach blueprint as object keys
and query parameters as an array, and seam-connect serializes its spec with
json-stringify-deterministic, which sorts object keys but cannot sort array
elements. So a body-described endpoint arrives alphabetically while a
query-described one arrives in declaration order, and an endpoint reorders for
no reason other than which representation describes it.

This is a pure reordering of existing output: regenerating the seam-blueprint
snapshot against the same @seamapi/types 1.1040.0 changes 1846 lines, and
every one is a line that also appears on the other side of the diff -- zero
lines genuinely added or removed. Verified by comparing the added and removed
line multisets.

The value is in what it makes reviewable next. Bumping to the semantic-method
spec (types 1.1042.0) currently churns 1608/1584 snapshot lines, of which only
46 are real; on top of this commit the same bump is 37/13, which is the real
change and nothing else.

One test expectation moves with the output: the exempt-endpoint test asserted
methods as ['POST', 'PATCH', 'PUT'], the order its fixture inserted the
pathItem keys in. It now asserts ['PATCH', 'POST', 'PUT']. The test is about a
three-method endpoint being allowed rather than rejected, which it still
covers. semanticMethod and preferredMethod are separate explicit fields, so
sorting the array loses no information about which method to prefer.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UgJLypfYKgaoAYq7fKy4fs
@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blueprint Ready Ready Preview Aug 26, 2026 6:33pm

Request Review

@razor-x
razor-x merged commit 8f37303 into main Aug 26, 2026
17 checks passed
@razor-x
razor-x deleted the claude/blueprint-normalize-ordering-bbvsrd branch August 26, 2026 18:38
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