Skip to content

Fix (forms): update schema for "redirect business mail" api#55

Merged
Ethical-Ralph merged 2 commits intodevelopfrom
fix/redirect-business-mail-api
Jan 16, 2026
Merged

Fix (forms): update schema for "redirect business mail" api#55
Ethical-Ralph merged 2 commits intodevelopfrom
fix/redirect-business-mail-api

Conversation

@sajclarke
Copy link
Contributor

@sajclarke sajclarke commented Jan 16, 2026

Description

This PR updates the post-office redirection form for businesses to align with the Figma design specifications. It includes schema restructuring to improve form organization and enhances validation to properly reject empty strings for required fields.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changes Made

  • Restructure business form schema to prioritize business name field at top level
  • Rename "oldBusinessAddress" to "currentAddress" for clarity
  • Update form field organization and grouping
  • Update field labels for consistency (e.g., "Address Line 1" → "Address line 1")
  • Add postcode field with Barbados postal code validation (BB#####)
  • Remove personal applicant details (title, firstName, lastName, dateOfBirth, etc.) from primary scope
  • Improve string validation to reject empty strings for required fields
  • Refactor schema-builder service to properly handle empty string validation
  • Add explicit validation for required fields that enforces minimum length of 1 character
  • Consolidate validation logic to consistently treat required vs optional string fields

Files Changed

  • schemas/post-office-redirection-business.json - Form schema restructuring (98 insertions, 103 deletions)
  • src/validation/schema-builder.service.ts - Enhanced string validation logic (35 changes: improved empty string handling and required field validation)

Notes

The validation improvements ensure that required string fields cannot be submitted with only whitespace or empty values, preventing invalid data from reaching the backend. The schema restructure makes the form more intuitive by presenting the business name first and reorganizing address sections logically.

Testing

  • Form validation tested with empty string inputs
  • Verify required fields reject whitespace-only values
  • Test optional fields accept empty strings
  • Verify form renders correctly with new schema structure
  • Test postcode validation (BB##### format)
  • Validate all parish selection works correctly
  • Check form submission with complete and partial data
  • Test responsive design across device sizes

Related Github Issue(s)/Trello Ticket(s)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Tests added/updated for validation logic
  • Documentation updated
  • Validation rules tested with edge cases

@amazon-inspector-n-virginia
Copy link

⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done

@amazon-inspector-n-virginia
Copy link

✅ I finished the code review, and didn't find any security or code quality issues.

@Ethical-Ralph Ethical-Ralph merged commit ab42bd9 into develop Jan 16, 2026
2 checks passed
Ethical-Ralph added a commit that referenced this pull request Jan 16, 2026
* Updated missing validation

* Fix (forms): update schema for "redirect business mail" api (#55)

* fix: update schema to match figma

* fix: update form schema and validations for empty strings

* fix: telephone validation in sell goods or services form (#53)

* fix (forms): change api for "Tell Post Office someone died" form (#54)

* fix: update schema for deceased form to match figma

* fix: gracefully fail if unable to connect to smtp server

* chore: update email error logic

---------

Co-authored-by: IsaiahSama <isaiahcarrington46@gmail.com>
Co-authored-by: Akinola Raphael <rakinola90@gmail.com>
@sajclarke sajclarke mentioned this pull request Jan 16, 2026
19 tasks
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.

2 participants