[PR #4477] [CLOSED] feat: openapi 422 response #13647

Closed
opened 2026-04-13 09:02:48 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4477
Author: @Z377A1
Created: 9/5/2025
Status: Closed

Base: canaryHead: origin/feat/openapi-422-response


📝 Commits (3)

  • 4c3cc2c feat: add and enhance 422 Unprocessable Content response
  • aa0a980 fix: update description from "Unprocessable Content" to "Unprocessable Entity" for 422 responses
  • 05c6d8f fix: format description for 422 response

📊 Changes

4 files changed (+49 additions, -0 deletions)

View changed files

📝 .gitignore (+3 -0)
📝 packages/better-auth/src/api/routes/sign-up.ts (+16 -0)
📝 packages/better-auth/src/api/routes/update-user.ts (+15 -0)
📝 packages/better-auth/src/plugins/username/index.ts (+15 -0)

📄 Description

This adds the 422 Unprocessable Entity response to the OpenAPI specification for the following endpoints:

  • /sign-up/email
  • /update-user
  • /sign-in/username

The 422 Unprocessable Entity response is used to indicate that the server understood the request but was unable to process it due to semantic errors, such as:

  • Attempting to sign up with an existing email.
  • Attempting to sign up with an invalid username.
  • Other validation errors that fall under the UNPROCESSABLE_ENTITY APIError.

Changes Made

  1. Updated the OpenAPI spec to include the 422 response for the endpoints that include the 422 Unprocessable Entity responses.

Documentation Reference

For more details on the 422 Unprocessable Content status code, see the MDN documentation.


Summary by cubic

Adds 422 Unprocessable Entity responses to the OpenAPI spec for sign-up, update-user, and username sign-in endpoints so clients can handle validation errors consistently.

  • New Features

    • Documented 422 responses for /sign-up/email, /update-user, and /sign-in/username with a JSON body schema: { message: string }.
  • Bug Fixes

    • Standardized the status description to “Unprocessable Entity” across these responses.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4477 **Author:** [@Z377A1](https://github.com/Z377A1) **Created:** 9/5/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `origin/feat/openapi-422-response` --- ### 📝 Commits (3) - [`4c3cc2c`](https://github.com/better-auth/better-auth/commit/4c3cc2c5bfbef87756234b80810cb2e257f28f86) feat: add and enhance 422 Unprocessable Content response - [`aa0a980`](https://github.com/better-auth/better-auth/commit/aa0a98025c97b792c0fdd8a1f9438cf21c6b2b4f) fix: update description from "Unprocessable Content" to "Unprocessable Entity" for 422 responses - [`05c6d8f`](https://github.com/better-auth/better-auth/commit/05c6d8fe8793ff40b4a4adfdd9fa35e68cc11d16) fix: format description for 422 response ### 📊 Changes **4 files changed** (+49 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+3 -0) 📝 `packages/better-auth/src/api/routes/sign-up.ts` (+16 -0) 📝 `packages/better-auth/src/api/routes/update-user.ts` (+15 -0) 📝 `packages/better-auth/src/plugins/username/index.ts` (+15 -0) </details> ### 📄 Description This adds the `422 Unprocessable Entity` response to the OpenAPI specification for the following endpoints: - `/sign-up/email` - `/update-user` - `/sign-in/username` The `422 Unprocessable Entity` response is used to indicate that the server understood the request but was unable to process it due to semantic errors, such as: - Attempting to sign up with an existing email. - Attempting to sign up with an invalid username. - Other validation errors that fall under the UNPROCESSABLE_ENTITY APIError. #### Changes Made 1. Updated the OpenAPI spec to include the `422` response for the endpoints that include the `422 Unprocessable Entity` responses. #### Documentation Reference For more details on the `422 Unprocessable Content` status code, see the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/422). <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds 422 Unprocessable Entity responses to the OpenAPI spec for sign-up, update-user, and username sign-in endpoints so clients can handle validation errors consistently. - **New Features** - Documented 422 responses for /sign-up/email, /update-user, and /sign-in/username with a JSON body schema: { message: string }. - **Bug Fixes** - Standardized the status description to “Unprocessable Entity” across these responses. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 09:02:48 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#13647