entity icon indicating copy to clipboard operation
entity copied to clipboard

Legal API: prefix/suffix whitespace validation for filings inconsistent with frontend validations

Open loneil opened this issue 2 weeks ago • 0 comments

As an API user, I want to get appropriate validation errors if I try and put a field in that has spacing that would not pass the frontend validation, so that my saved data is accurate and reliable and will not cause issues if used again through the frontend


During filing validation analysis we've seen a lot of fields (usually address related) where the frontend restricts from having whitespace leading or trailing a string field, but the API does not hold to that validation

These are the fields so far where this discrepancy is found:

Filing Area Fields
Incorporation Application Offices > Registered office/Records Office Delivery/mailing address > streetAddress, addressCity, addressCountry, postalCode
Incorporation Application Parties Delivery/mailing address > streetAddress, addressCity, addressCountry, postalCode
Incorporation Application Parties firstName, lastName
Incorporation Application Contact Point email
Change of Address Offices > Registered office/Records Office Delivery/mailing address > streetAddress, addressCity, addressCountry, postalCode

Dev Notes

Frontend example restricting whitespace: Image

Note that when fetching a business in the dashboard and looking, or generating outputs, that it usually seems to strip the whitespaces. But they do make it to the database, see data from an example API filing below:

Image Image

QA Notes For all of the use cases defined in this issue in the table above

  • Regression test that the field still works as expected in the frontend
  • Regression test that the filing can be completed with data in those fields when done through the frontend
  • For the fields defined in the table, ensure that calling through the API (with the postman collection) gives the appropriate validation for whitespace.

loneil avatar Dec 22 '25 17:12 loneil