Skip to content

fix(openapi): keep request body with empty-schema fallback - #6

Merged
isaacwasserman merged 1 commit into
mainfrom
fix-request-body-fallback
Jul 13, 2026
Merged

fix(openapi): keep request body with empty-schema fallback#6
isaacwasserman merged 1 commit into
mainfrom
fix-request-body-fallback

Conversation

@isaacwasserman

Copy link
Copy Markdown
Owner

Resolves the new Greptile P1 on better-auth#153 ("Body Schemas Disappear"): when an endpoint declares a body but the schema library doesn't expose ~standard.jsonSchema, getRequestBody returned undefined, so a body-consuming route was documented as bodyless and generated clients could omit JSON the runtime expects. This falls back to an empty schema (toJsonSchema(...) ?? {}, which accepts any JSON) so a declared body is always documented; only the schema shape degrades. Adds a regression test using a converter-less Standard Schema. All 202 tests and the tsdown build pass.

🤖 Generated with Claude Code

When `options.body` is declared but the schema library doesn't expose
`~standard.jsonSchema`, `getRequestBody` returned undefined and dropped the
request body, documenting a body-consuming route as bodyless. Fall back to an
empty schema (accepts any JSON) so the requestBody is always emitted; only the
schema shape degrades. Adds a regression test with a converter-less schema.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@isaacwasserman
isaacwasserman merged commit e13816f into main Jul 13, 2026
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