Skip to content

31953 Added new validators package#301

Merged
severinbeauvais merged 2 commits intomainfrom
31953
Feb 9, 2026
Merged

31953 Added new validators package#301
severinbeauvais merged 2 commits intomainfrom
31953

Conversation

@severinbeauvais
Copy link
Collaborator

Issue #: bcgov/entity#31953

Description of changes:

  • added new package declaration
  • created validators folder
  • added index file
  • added initial package file
  • added ValidatePostalCode file

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the business-filings-ui license (Apache 2.0).

- created validators folder
- added index file
- added initial package file
- added ValidatePostalCode file
@@ -0,0 +1,12 @@
{
"name": "@bcrs-shared-components/validators",
"version": "0.0.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lerna will update this when I run it after merging this change.

Copy link
Collaborator Author

@severinbeauvais severinbeauvais Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll choose 1.0.0 for the first published version :)

"src/services",
"src/types",
"src/services"
"src/validators"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

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

Adds a new @bcrs-shared-components/validators package to the monorepo and introduces an initial postal code validator, wiring the new package into Lerna so it can be versioned/published alongside existing packages.

Changes:

  • Created new src/validators package with an index.ts barrel export.
  • Added validatePostalCode implementation for Canadian postal code format validation.
  • Updated lerna.json to include the new src/validators package (and re-ordered package paths).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/validators/validate-postal-code.ts Introduces validatePostalCode using a Canada postal code regex.
src/validators/index.ts Exposes validator(s) via a barrel export.
src/validators/package.json Defines the new Lerna-managed package metadata.
lerna.json Registers src/validators as a Lerna package path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@loneil loneil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense right now to ignore copilot comments about the validator as they are tested and in-use already on multiple UI projects so don't want to change behavior IMO (just commonize for now)

@severinbeauvais
Copy link
Collaborator Author

Makes sense right now to ignore copilot comments about the validator as they are tested and in-use already on multiple UI projects so don't want to change behavior IMO (just commonize for now)

As long as the "required" validator is used before the "validatePostalCode" validator, it should behave the same before and now.

I've made a mental note to test this once it's imported in to Create UI :)

- added unit tests
@severinbeauvais severinbeauvais merged commit 412e0bc into main Feb 9, 2026
7 checks passed
@severinbeauvais
Copy link
Collaborator Author

I've made a mental note to test this once it's imported in to Create UI :)

Tested and works fine in Create UI.

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