-
Notifications
You must be signed in to change notification settings - Fork 81
31798 Add validation for contact point email in IA #4001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3c45400 to
ed18fc4
Compare
95a9412 to
d8d6ea8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds email validation to the Incorporation Application filing to address a validation mismatch between the API and Create UI. The API now uses the same RFC 5322 compliant email regex pattern as the frontend.
Changes:
- Added
validate_emailfunction to common validations with RFC 5322 compliant regex pattern - Integrated email validation into incorporation application validation flow
- Added comprehensive unit tests for email validation covering valid and invalid formats
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| legal-api/src/legal_api/services/filings/validations/common_validations.py | Added EMAIL_PATTERN constant and validate_email function to validate email format |
| legal-api/src/legal_api/services/filings/validations/incorporation_application.py | Imported and called validate_email function in incorporation application validation |
| legal-api/tests/unit/services/filings/validations/test_common_validations.py | Added comprehensive tests for validate_email function including edge cases |
| legal-api/tests/unit/services/filings/validations/test_incorporation_application.py | Added parametrized test for email validation in incorporation application context |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
legal-api/tests/unit/services/filings/validations/test_common_validations.py
Show resolved
Hide resolved
legal-api/src/legal_api/services/filings/validations/incorporation_application.py
Outdated
Show resolved
Hide resolved
legal-api/src/legal_api/services/filings/validations/common_validations.py
Outdated
Show resolved
Hide resolved
legal-api/tests/unit/services/filings/validations/test_incorporation_application.py
Show resolved
Hide resolved
legal-api/src/legal_api/services/filings/validations/common_validations.py
Show resolved
Hide resolved
Signed-off-by: Lucas <lucasoneil@gmail.com>
803bbe0 to
92c42fc
Compare
Issue #: /bcgov/entity#31798
Description of changes:
Add a validate email check in the Incorporation application validation to check the Contact Point email validation.
The contact point schema has a format of
emailbut the jsonschema validation for draft7 (and newer) just verifies with a "does it have@in it" (see format)This addresses the validation mismatch between relying on that simple check and the more complex one done in Create UI here.
Use the same regex as used in the UI here in the API for check.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the lear license (Apache 2.0).