docs(handler): document exact password validation error message strings#181
Merged
veverkap merged 1 commit intoMay 3, 2026
Conversation
The errPasswordTooShort and errPasswordTooLong package-level vars in handler/helpers.go now make the exact error strings explicit in the code. Surface them in the auth and password-reset handler docs so API clients know the exact JSON error body they will receive for out-of-range passwords, and can display or localize them appropriately. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the handler documentation to include the exact password-length validation error strings returned by the HTTP handlers, aligning the reference docs with the current server behavior.
Changes:
- Document the exact JSON
{"error": "..."}bodies returned for passwords shorter than 8 bytes and longer than 72 bytes. - Expand the “Password constraints” notes in AuthHandler and PasswordResetHandler docs (including bcrypt cost inline for AuthHandler).
Show a summary per file
| File | Description |
|---|---|
| docs/handler/auth.md | Adds the exact too-short/too-long password error strings (and keeps bcrypt cost in the constraints note). |
| docs/handler/password-reset.md | Adds the exact too-short/too-long password error strings for the ResetPassword flow. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Following the
perf(handler)change in #172 that promoted the password error strings to explicit named package-level vars (errPasswordTooShort,errPasswordTooLong), this PR surfaces those exact strings in the handler documentation.Changes
docs/handler/auth.md— Expands the "Password constraints" note to include the exact JSON error bodies a client receives for too-short (< 8 bytes) and too-long (> 72 bytes) passwords, and combines the bcrypt cost inline.docs/handler/password-reset.md— Same addition for theResetPasswordendpoint.Before / After
Before:
Why
API clients (and their localisation layers) need to know the exact error string to match or replace. Now that the strings are named constants in the source, documenting them closes the gap between code and reference docs.
Greptile Summary
This PR updates two documentation files to surface the exact JSON error bodies returned for out-of-range passwords, referencing the named package-level error vars introduced in #172. The documented strings (
"password must be at least 8 bytes"/"password must be at most 72 bytes") and the{"error": "..."}JSON shape match the source code inhandler/helpers.goexactly.Confidence Score: 5/5
Documentation-only change; verified error strings and JSON shape match source exactly — safe to merge.
No code changes; the two documented error strings and {"error": "..."} envelope were cross-checked against handler/helpers.go and are correct.
No files require special attention.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Client sends password] --> B{len less than 8 bytes?} B -- Yes --> C[HTTP 400 - password must be at least 8 bytes] B -- No --> D{len greater than 72 bytes?} D -- Yes --> E[HTTP 400 - password must be at most 72 bytes] D -- No --> F[Password accepted - bcrypt cost 12]Reviews (1): Last reviewed commit: "docs(handler): document exact password v..." | Re-trigger Greptile