| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Invalid emails no longer persist their value after failed UnmarshalJSON validation, since the new net/mail-based validation sets the value only after successful parsing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
📧 Improve email validation using net/mail instead of regex
Context
Currently, our email validation is using a regex pattern that doesn't fully support all valid email separators according to RFC 5322. This PR replaces it with Go's built-in net/mail.ParseAddress which properly handles all valid email characters.
Changes
Before
The current regex validation fails with valid email addresses containing special characters like +, {, }, ~, * etc.
Example of a valid email that was incorrectly rejected:
validemail+with_valid-separator{like}~these*ones@openapicodegen.com ❌
After
Using net/mail.ParseAddress, we now correctly validate emails containing all RFC 5322 compliant characters:
validemail+with_valid-separator{like}~these*ones@openapicodegen.com ✅
This change makes our email validation more robust and standards-compliant while actually simplifying the code by leveraging Go's standard library.
Would love to get this merged to improve our validation capabilities! Let me know if you'd like any changes or have questions. 🚀