Skip to content

Conversation

@loneil
Copy link
Collaborator

@loneil loneil commented Jan 15, 2026

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 email but 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).

@loneil loneil changed the title Add validation for contact point email in IA 31798 Add validation for contact point email in IA Jan 15, 2026
@loneil loneil force-pushed the 31798contactPointEmailValidation branch 2 times, most recently from 3c45400 to ed18fc4 Compare January 15, 2026 01:30
@loneil loneil self-assigned this Jan 15, 2026
@loneil loneil force-pushed the 31798contactPointEmailValidation branch from 95a9412 to d8d6ea8 Compare January 15, 2026 05:26
@loneil loneil marked this pull request as ready for review January 15, 2026 05:54
Copilot AI review requested due to automatic review settings January 15, 2026 05:54
Copy link
Contributor

Copilot AI left a 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_email function 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.

Signed-off-by: Lucas <lucasoneil@gmail.com>
@loneil loneil force-pushed the 31798contactPointEmailValidation branch from 803bbe0 to 92c42fc Compare January 15, 2026 16:50
@loneil loneil merged commit 63770de into bcgov:main Jan 16, 2026
4 checks passed
@loneil loneil deleted the 31798contactPointEmailValidation branch January 16, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants