Skip to content

feat(codegen): name operations from the route when the operationId is mechanical - #548

Merged
Mkassabov merged 1 commit into
mainfrom
feat/route-derived-verbnoun
Sep 7, 2026
Merged

feat(codegen): name operations from the route when the operationId is mechanical#548
Mkassabov merged 1 commit into
mainfrom
feat/route-derived-verbnoun

Conversation

@Mkassabov

Copy link
Copy Markdown
Collaborator

Follow-up to #545, needed before the SDK batch (#484#533) is regenerated.

Many of those specs have no operationId (Resend, Superset, OVH) or a mechanical one that only restates the route (get-api-card, post_v1_users_id, postV1AppsByAppIdPromote, Stripe's PostAccountsAccount). toVerbNoun left those as getApiCard / postV1UsersId.

The OpenAPI converter now classifies each operationId:

id rule example
absent derived from the route; list only when the 200 body is a collection GET /userslistUsers, GET /users/{id}getUser, POST /users/{id}/resetresetUser
verbatim route (getV1AppsByAppId, GetAccountsAccount, getCustomerById) same nouns, author's verb kept, parameter clauses dropped, POST /x/{id}update PostAccountsAccountupdateAccount
method-prefixed with chosen nouns (get-feeds, deleteScheduledJob, get_webhook_by_token) nouns kept verbatim; only post/patch and a trailing ById normalised getCustomerByIdgetCustomer
anything else toVerbNoun as before

/api and /vN roots are dropped. Two routes that derive the same name (/collections/{slug}, /collections/{slug}-{id}) get a By<param> suffix instead of a counter. 224 test cases in rewrite-operation-ids.test.ts.

Regenerated 75 files across the tracked packages; the renames are confined to mechanical ids (Stripe, Coinbase, prisma-postgres, Vercel's ByTeamSlugByProjectSlug… chains).

… mechanical

Many specs in the SDK batch have no operationId (Resend, Superset, OVH) or
a mechanical one that just restates the route (`get-api-card`,
`post_v1_users_id`, `postV1AppsByAppIdPromote`, Stripe's
`PostAccountsAccount`). toVerbNoun left those as `getApiCard` /
`postV1UsersId`, which is not verbNoun.

The OpenAPI converter now classifies each operationId:

- absent → named from the route: `GET /users` → listUsers (when the 200
  body is a collection, else getUsers), `GET /users/{id}` → getUser,
  `POST /users` → createUser, `POST /users/{id}` → updateUser,
  `POST /users/{id}/reset` → resetUser. `/api` and `/vN` roots are dropped.
- verbatim route id (`getV1AppsByAppId`, `GetAccountsAccount`,
  `getCustomerById`) → same derivation, but the author's verb is kept and
  parameter clauses (`ByAppId`, `Id`, an echoed `{account}`) are dropped.
- method-prefixed with chosen nouns (`get-feeds`, `deleteScheduledJob`,
  `get_webhook_by_token`) → nouns kept verbatim; only `post`/`patch` and a
  trailing `ById` are normalised.
- anything else → toVerbNoun as before.

Two routes that derive the same name (`/collections/{slug}` and
`/collections/{slug}-{id}`) get a `By<param>` suffix instead of a counter.
Regular `-ys` plurals (`keys`, `days`) now singularise. 224 cases.

Regenerated: 75 files; the renames are confined to mechanical ids
(Stripe `postAccountsAccount` → `updateAccount`, Coinbase `…ById`,
prisma-postgres `postV1…`, Vercel's `ByTeamSlugByProjectSlug…` chains).
@alchemy-version-bot

Copy link
Copy Markdown
Contributor

Install the packages built from this commit:

Distilled

@distilled.cloud/core

bun add https://pkg.ing/@distilled.cloud/core/1a57f14

@distilled.cloud/aws

bun add https://pkg.ing/@distilled.cloud/aws/1a57f14

@distilled.cloud/axiom

bun add https://pkg.ing/@distilled.cloud/axiom/1a57f14

@distilled.cloud/azure

bun add https://pkg.ing/@distilled.cloud/azure/1a57f14

@distilled.cloud/cloudflare

bun add https://pkg.ing/@distilled.cloud/cloudflare/1a57f14

@distilled.cloud/coinbase

bun add https://pkg.ing/@distilled.cloud/coinbase/1a57f14

@distilled.cloud/discord

bun add https://pkg.ing/@distilled.cloud/discord/1a57f14

@distilled.cloud/expo-eas

bun add https://pkg.ing/@distilled.cloud/expo-eas/1a57f14

@distilled.cloud/fly-io

bun add https://pkg.ing/@distilled.cloud/fly-io/1a57f14

@distilled.cloud/gcp

bun add https://pkg.ing/@distilled.cloud/gcp/1a57f14

@distilled.cloud/github

bun add https://pkg.ing/@distilled.cloud/github/1a57f14

@distilled.cloud/hetzner

bun add https://pkg.ing/@distilled.cloud/hetzner/1a57f14

@distilled.cloud/kubernetes

bun add https://pkg.ing/@distilled.cloud/kubernetes/1a57f14

@distilled.cloud/mongodb-atlas

bun add https://pkg.ing/@distilled.cloud/mongodb-atlas/1a57f14

@distilled.cloud/neon

bun add https://pkg.ing/@distilled.cloud/neon/1a57f14

@distilled.cloud/planetscale

bun add https://pkg.ing/@distilled.cloud/planetscale/1a57f14

@distilled.cloud/posthog

bun add https://pkg.ing/@distilled.cloud/posthog/1a57f14

@distilled.cloud/prisma-postgres

bun add https://pkg.ing/@distilled.cloud/prisma-postgres/1a57f14

@distilled.cloud/railway

bun add https://pkg.ing/@distilled.cloud/railway/1a57f14

@distilled.cloud/stripe

bun add https://pkg.ing/@distilled.cloud/stripe/1a57f14

@distilled.cloud/supabase

bun add https://pkg.ing/@distilled.cloud/supabase/1a57f14

@distilled.cloud/turso

bun add https://pkg.ing/@distilled.cloud/turso/1a57f14

@distilled.cloud/typesense

bun add https://pkg.ing/@distilled.cloud/typesense/1a57f14

@distilled.cloud/vercel

bun add https://pkg.ing/@distilled.cloud/vercel/1a57f14

@distilled.cloud/workos

bun add https://pkg.ing/@distilled.cloud/workos/1a57f14

@Mkassabov
Mkassabov added this pull request to the merge queue Sep 7, 2026
Merged via the queue into main with commit 7d2d8f2 Sep 7, 2026
4 checks passed
@Mkassabov
Mkassabov deleted the feat/route-derived-verbnoun branch September 7, 2026 11:21
Mkassabov added a commit that referenced this pull request Sep 7, 2026
…pipeline

Rebased on main after #545/#548. Also resolves the root re-export clash
between the Credentials service and the API's own Credentials schema
(the schema stays reachable as Services.digitalocean.Credentials), which
was failing the package typecheck.
Mkassabov added a commit that referenced this pull request Sep 7, 2026
…line

Rebased on main after #545/#548. The `provider.auth` operation is named
listProviderAuthMethods: its default `ProviderAuthError` union alias
collided with the spec's own ProviderAuthError schema and failed the
package typecheck.
Mkassabov added a commit that referenced this pull request Sep 7, 2026
…peline

Rebased on main after #545/#548. Two pre-existing typecheck failures are
fixed on the way: the offset pagination stamp now uses the core `token`
mode (nextOffset is fed back as offset verbatim, which is what token mode
does), and the root re-exports only Conflict — the spec declares 409 and
nothing else, so BadRequest/Forbidden/NotFound were never emitted.
Mkassabov added a commit that referenced this pull request Sep 7, 2026
…oun pipeline

Rebased on main after #545/#548. convert now runs finalizeConvert over
stable/ and unstable/, as gcp's does, so the models carry the verbNoun
names and the finalized marker.
Mkassabov added a commit that referenced this pull request Sep 7, 2026
…pipeline

Rebased on main after #545/#548. Also resolves the root re-export clash
between the Credentials service and the API's own Credentials schema
(the schema stays reachable as Services.digitalocean.Credentials), which
was failing the package typecheck.
Mkassabov added a commit that referenced this pull request Sep 7, 2026
…line

Rebased on main after #545/#548. The `provider.auth` operation is named
listProviderAuthMethods: its default `ProviderAuthError` union alias
collided with the spec's own ProviderAuthError schema and failed the
package typecheck.
Mkassabov added a commit that referenced this pull request Sep 7, 2026
…peline

Rebased on main after #545/#548. Two pre-existing typecheck failures are
fixed on the way: the offset pagination stamp now uses the core `token`
mode (nextOffset is fed back as offset verbatim, which is what token mode
does), and the root re-exports only Conflict — the spec declares 409 and
nothing else, so BadRequest/Forbidden/NotFound were never emitted.
Mkassabov added a commit that referenced this pull request Sep 7, 2026
…oun pipeline

Rebased on main after #545/#548. convert now runs finalizeConvert over
stable/ and unstable/, as gcp's does, so the models carry the verbNoun
names and the finalized marker.
Mkassabov added a commit that referenced this pull request Sep 7, 2026
Rebased on main after #545/#548/#549. convert ends in finalizeConvert.
Operation names are verbNoun: a camelCase Slack action is used as-is
(chat.postMessage → postMessage); a bare action is handed to the
converter as Object_action so its policy orders it
(admin.apps.permissions.add → addAppsPermissions, conversations.archive
→ archiveConversation). package.json uses the named pnpm catalogs, and
slack is registered as a blocked spec repo (the docs JSON twins are
committed in-repo).
Mkassabov added a commit that referenced this pull request Sep 7, 2026
Rebased on main after #545/#548/#549. convert ends in finalizeConvert.
Operation names are verbNoun: a camelCase Slack action is used as-is
(chat.postMessage → postMessage); a bare action is handed to the
converter as Object_action so its policy orders it
(admin.apps.permissions.add → addAppsPermissions, conversations.archive
→ archiveConversation). package.json uses the named pnpm catalogs, and
slack is registered as a blocked spec repo (the docs JSON twins are
committed in-repo).
wyattjoh added a commit to wyattjoh/distilled that referenced this pull request Sep 7, 2026
Ports codegen/patches.ts, codegen/rewrite-operation-ids.ts, and
codegen/spec-path.ts from main (alchemy-run#545, alchemy-run#548, alchemy-run#549). Purely additive: no
package on this branch imports them yet. isStaleTargetError is called
with the message rather than the thrown value, so core/json-patch.ts
stays untouched.
wyattjoh added a commit to wyattjoh/distilled that referenced this pull request Sep 8, 2026
Ports codegen/patches.ts, codegen/rewrite-operation-ids.ts, and
codegen/spec-path.ts from main (alchemy-run#545, alchemy-run#548, alchemy-run#549). Purely additive: no
package on this branch imports them yet. isStaleTargetError is called
with the message rather than the thrown value, so core/json-patch.ts
stays untouched.
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.

1 participant