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

docs: update with notes about validity for zips #2963

Merged
merged 3 commits into from
Jun 11, 2024

Conversation

garrettgregor
Copy link
Contributor

Motivation / Background

This Pull Request has been created because of issues I had run into whil previously trying to generate zip/postcode data. This came from a suggestion by @stefannibrasil πŸ™‡πŸ»β€β™‚οΈ .

Additional information

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug, refactor something, or add a feature.
  • Tests and Rubocop are passing before submitting your proposed changes.

If you're proposing a new generator or locale:

  • Double-check the existing generators documentation to make sure the new generator you want to add doesn't already exist.
  • You've reviewed and followed the Contributing guidelines.

Copy link
Contributor

@stefannibrasil stefannibrasil left a comment

Choose a reason for hiding this comment

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

thank you @garrettgregor ! Left two small suggestions.

Comment on lines 20 to 26
#note: #zip_code will return a random string in zipcode format; may or may not be a valid US zip
Faker::Address.zip_code #=> "58517" or "23285-4905"

#note: #zip will return a random string in zipcode format; may or may not be a valid US zip
Faker::Address.zip #=> "58517" or "66259-8212"

#note: #postcode will return a random string in postcode format; may or may not be a valid US zip
Copy link
Contributor

Choose a reason for hiding this comment

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

We generate zip codes for other countries, too.

Suggested change
#note: #zip_code will return a random string in zipcode format; may or may not be a valid US zip
Faker::Address.zip_code #=> "58517" or "23285-4905"
#note: #zip will return a random string in zipcode format; may or may not be a valid US zip
Faker::Address.zip #=> "58517" or "66259-8212"
#note: #postcode will return a random string in postcode format; may or may not be a valid US zip
#note: #zip_code will return a random string in zipcode format; may or may not be a valid zip
Faker::Address.zip_code #=> "58517" or "23285-4905"
#note: #zip will return a random string in zipcode format; may or may not be a valid zip
Faker::Address.zip #=> "58517" or "66259-8212"
#note: #postcode will return a random string in postcode format; may or may not be a valid zip

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this accept something other than a US state? Will it adjust this per locale? If so maybe it would also be good to specify that this may or may not be a valid zip for the locale?

Copy link
Contributor

Choose a reason for hiding this comment

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

It will adjust per locale, yes. Saying that it may not be valid for the locale sounds good to me, thanks!

lib/faker/default/address.rb Show resolved Hide resolved
@garrettgregor
Copy link
Contributor Author

Updated with latest main and verbiage about locale instead of US zips.

Copy link
Contributor

@stefannibrasil stefannibrasil left a comment

Choose a reason for hiding this comment

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

Thank you!

@stefannibrasil stefannibrasil merged commit 7d14d42 into faker-ruby:main Jun 11, 2024
8 checks passed
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