faker-ruby / faker

A library for generating fake data such as names, addresses, and phone numbers.
MIT License
11.28k stars 3.18k forks source link

feat: generate real USA state or territory zip code #2951

Closed garrettgregor closed 6 months ago

garrettgregor commented 6 months ago

Motivation / Background

This Pull Request has been created because in a prior application I had been using Faker to generate zip codes for US states and was running into issues where the zip codes provided by Faker were causing my application to crash. At that point, I determined that the reason for this was that the zip codes being generated were random, and I needed real data for the call to a weather API to work correctly. I thought that for future users of Faker, it would be useful to have the ability to generate either fake or real US zip codes, so I brought in real US states and territories zips to allow for that possibility.

Additional information

Checklist

Before submitting the PR make sure the following are checked:

If you're proposing a new generator or locale:

stefannibrasil commented 6 months ago

hi @garrettgregor thanks for contributing to faker but we're not a library that generates any real data. We can't maintain valid data for any generators as we are used for generating random data. If your app relies on valid zip codes, I would recommend not using any sort of random generated values at all and using another library that validates ZIP codes. Thanks.

garrettgregor commented 6 months ago

Hi Stefanni!

Thanks for getting back to me so quickly - sounds like we might have just missed each other at RailsConf! While I understand your perspective, I would kindly ask for reconsideration as not all of the data within Faker is "fake". For instance, the states and state abbreviations are not "fake" and this lack of clarity within what is being produced can often lead to confusion when using faker generating what one thought was simply a random zip code from a specified state.

All the best,

stefannibrasil commented 6 months ago

Hi @garrettgregor please say hi next time :)

Yeah, I understand there is some confusion right now with how the generators work and what is fake and whatnot. Now that RailsConf is over, we'll work on restructuring the library to make it more maintainable and easier to use. Right now, we'll have to deal with the inconsistencies, unfortunately.

One thing we can think from this for now is to update the docs to mention the ZIP codes are not real to keep that clear for others, if you're up for it.

garrettgregor commented 6 months ago

If you're suggesting submitting a pull request to add to the documentation I would absolutely be willing to help with that!

stefannibrasil commented 6 months ago

yes, you're correct. that'd be great, thank you!

garrettgregor commented 6 months ago

Submitted! Thanks for the suggestion Stefanni!