Repository navigation
test(open-api): lock in requestBody for /phone-number/verify - #11208
Conversation
|
@devtechedge is attempting to deploy a commit to the better-auth Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
@better-auth/api-key
better-auth
@better-auth/cimd
auth
@better-auth/core
@better-auth/drizzle-adapter
@better-auth/electron
@better-auth/expo
@better-auth/i18n
@better-auth/kysely-adapter
@better-auth/mcp
@better-auth/memory-adapter
@better-auth/mongo-adapter
@better-auth/oauth-provider
@better-auth/passkey
@better-auth/prisma-adapter
@better-auth/redis-storage
@better-auth/scim
@better-auth/sso
@better-auth/stripe
@better-auth/telemetry
@better-auth/test-utils
commit: |
|
Thanks @bytaesu - the tighter additionalProperties check and the all-paths requestBody loop are better than what I landed. Appreciate you taking that on this PR. |
bytaesu
left a comment
There was a problem hiding this comment.
Thank you @devtechedge
LGTM!
|
Thanks for reviewing and merging this, @bytaesu. Glad #8122 is closed. Runtime on Locking the reported endpoint (and the rest of the phone-number POST paths) next to the existing email-otp coverage should keep that from coming back quietly. Appreciate you taking the time on a tests-only PR! |
…erge, prettier skip - Merged: add better-auth/better-auth#11208 (merged 9 Sep 2026 08:19:43 UTC) Previously misfiled under Pipeline as 'merged upstream; historical context'. - Closed (not merged): add Kludex/starlette#3533 (closed by author, competing PRs #3529/#3531 already covered it) - row was missing entirely. - Pipeline: add prettier/prettier#19985 (already fixed upstream by #19838 on 15 Aug 2026; closed 10 Sep 2026 via test-only #20020). Comments only, no PR. - Pipeline: drop better-auth#11208 now that it is counted in Merged. - Totals corrected 18->20 external PRs; merged badge 5->6; closed 4->5. Verified against live GitHub API: 9 open / 6 merged / 5 closed.
…erge, prettier skip - Merged: add better-auth/better-auth#11208 (merged 9 Sep 2026 08:19:43 UTC) Previously misfiled under Pipeline as 'merged upstream; historical context'. - Closed (not merged): add Kludex/starlette#3533 (closed by author, competing PRs #3529/#3531 already covered it) - row was missing entirely. - Pipeline: add prettier/prettier#19985 (already fixed upstream by #19838 on 15 Aug 2026; closed 10 Sep 2026 via test-only #20020). Comments only, no PR. - Pipeline: drop better-auth#11208 now that it is counted in Merged. - Totals corrected 18->20 external PRs; merged badge 5->6; closed 4->5. Verified against live GitHub API: 9 open / 6 merged / 5 closed.
Closes #8122
Summary
/phone-number/verifydropped its OpenAPIrequestBodyafter v1.4.19. The body schema isz.object({…}).and(z.record(z.string(), z.any()))so additional user fields can pass throughsignUpOnVerification. The generator had noZodIntersectionhandler, soinstanceof ZodObjectwas false and the body was omitted from the spec.Runtime was never broken. Generated clients were:
swift-openapi-generatorproduced a verify function with no parameters.On current
main(1.7.3) the generator already flattens object+record intersections./sign-in/email-otpuses the same.and(z.record())pattern and already has coverage. This PR does not retouch the generator. It adds the reported phone-number endpoint as a regression so #8122 cannot silently come back.Problem (from #8122)
Repro from the issue, still the schema on
main:Expected:
POST /phone-number/verifyemitsrequestBodywith requiredphoneNumberandcode.v1.4.19 / v1.6.26:
requestBodymissing./phone-number/send-otpstayed intact because it is a plainz.object.Confirmed on v1.6.26 (6 Aug). Previous attempt: #9472 (same root cause, closed unmerged 13 May, no review). @pupuking723 claimed it verbally on 23 Aug with no PR since.
What this PR adds
packages/better-auth/src/plugins/open-api/open-api.test.tsonly.openAPI()+phoneNumber({ sendOTP, signUpOnVerification })— same options as the original repro.requestBody:/sign-in/phone-number/phone-number/send-otp/phone-number/verify/phone-number/request-password-reset/phone-number/reset-password/phone-number/verify:requestBody.required === truetype: "object"phoneNumber,codedisableSession,updatePhoneNumber(boolean, not inrequired)additionalProperties: {}— the.and(z.record(z.string(), z.any()))extra-keys contract, matching the existing email-otp assertionNo production code. No changeset.
Verification
32 passed, including the two new phone-number cases. Biome + cspell clean on the commit.
Related
/phone-number/verifyrequestBody (this PR)/sign-in/email-otpin this file (should merge object and record intersections for email OTP sign-in request bodies)Agent disclosure
Written by an AI agent on behalf of @devtechedge, who has reviewed this pull request.
Summary by cubic
Adds regression tests for the OpenAPI
requestBodyon phone-number POST endpoints, locking in the/phone-number/verifybody that was missing from generated specs since v1.4.19. The bug came from the generator not handlingZodIntersection, but runtime was never affected. No production code changes; the tests assert required fields, optional fields, and theadditionalPropertiescontract, closing #8122.Written for commit 5e44d9f. Summary will update on new commits.