Skip to content
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

Include postal code example #128

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Etroid
Copy link

@Etroid Etroid commented May 19, 2019

Problem/Motivation

There are many scenarios in which the postal code validation return ambiguous error messages. It might be useful to provide some additional context through a valid example. Google provides a list of valid postal code examples under the zipex property. As a first step to improve postal code validation, we would need to include this property in the addressing resources.

  • Updated generate_address_data.php to include zipex on both country and subdivision level
  • Added property postalCodeExample and getter to AddressFormat class

Closes #127

@bojanz
Copy link
Contributor

bojanz commented May 31, 2019

This is a good idea. However, it looks incomplete. The generate script also creates a postal_code_example for subdivisions, but the subdivision json files weren't updated, and neither was Subdivision.php

* This is an example postal code used to provide additional context to the
* end-user. It can be displayed as a placeholder, field description or as
* part of the validation.
* (E.g. Zip code 12345 is not valid for Louisana (Example: 70001).
Copy link
Contributor

Choose a reason for hiding this comment

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

Sentence starts with a parenthesis, but doesn't end with one. I suggest just leaving out the first one and starting with just "E.g."

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the feedback. I've addressed this in 7cb62ca

@Etroid
Copy link
Author

Etroid commented May 31, 2019

Included subdivisions resources and added postal_code_example to both AddressFormat and SubDivision

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.

Include postal code example per country/subdivision
2 participants