Skip to content

fix(config): strip trailing Json suffix from generated schema names#24

Merged
gjtorikian merged 1 commit into
mainfrom
fix-strip-json-suffix-from-schema-names
May 19, 2026
Merged

fix(config): strip trailing Json suffix from generated schema names#24
gjtorikian merged 1 commit into
mainfrom
fix-strip-json-suffix-from-schema-names

Conversation

@gjtorikian
Copy link
Copy Markdown
Collaborator

Summary

Schemas in the spec carry a Json suffix (WebhookEndpointJson, AuditLogExportJson, AuditLogsRetentionJson, AuditLogSchemaJson, AuditLogActionJson) that leaks straight through into SDK type names — no other resource in the SDK uses this convention. The Node SDK's webhook-endpoint surface, for example, ends up with WebhookEndpointJson, WebhookEndpointJsonResponse, WebhookEndpointJsonStatus instead of the cleaner WebhookEndpoint, WebhookEndpointResponse, WebhookEndpointStatus.

Changes

  • oagen.config.ts::schemaNameTransform — add .replace(/Json$/, '') alongside the existing Dto/DTO strippers.

Why end-anchored

Json$ only matches when Json is at the very end of the schema name. A hypothetical JsonSchema schema (or any name with Json in the middle) is left alone. Surveyed all current Json-containing schemas: all five are pure suffixes. Derived names like WebhookEndpointJsonStatus are built from the transformed parent (WebhookEndpoint + Status), so they get the rename for free.

Test plan

  • npm run sdk:check — config loads
  • Regenerated workos-node end-to-end:
    • Type names: WebhookEndpoint, WebhookEndpointResponse, WebhookEndpointStatus
    • File names: webhook-endpoint.interface.ts, webhook-endpoint.serializer.ts
    • All references in webhooks.ts use the new names; tests in webhooks.spec.ts typecheck

🤖 Generated with Claude Code

Schemas in the spec carry a `Json` suffix (`WebhookEndpointJson`,
`AuditLogExportJson`, `AuditLogsRetentionJson`, `AuditLogSchemaJson`,
`AuditLogActionJson`) that leaks straight through into SDK type names
— no other resource in the SDK uses this convention. Strip the
trailing `Json` from schema names so consumers see `WebhookEndpoint`
instead of `WebhookEndpointJson` (and derived enum names like
`WebhookEndpointStatus` instead of `WebhookEndpointJsonStatus`).

Pattern is anchored to end-of-name so a hypothetical `JsonSchema`
schema (or anything with `Json` in the middle) is left alone. All
existing `Json`-suffixed schemas are surveyed and confirmed to be
pure suffixes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gjtorikian gjtorikian merged commit cb5e8ed into main May 19, 2026
5 checks passed
@gjtorikian gjtorikian deleted the fix-strip-json-suffix-from-schema-names branch May 19, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant