jaswdr / faker

:rocket: Ultimate fake data generator for Go with zero dependencies
https://pkg.go.dev/github.com/jaswdr/faker
MIT License
549 stars 59 forks source link

[BUG] person first and last names should not contain double-quotes #151

Closed mwgrimm closed 11 months ago

mwgrimm commented 12 months ago

Describe the bug The list of first and last names that can be generated for a person (and subsequently, all other data types that use these) contain several that include double-quotes. Ex. (https://github.com/jaswdr/faker/blob/master/person.go#L102). A double-quote is generally not a valid character to be included in a person's name. Names such as the ones in this list would instead typically use a single-quote or apostrophe.

To Reproduce

seed := int64(5272036870)
f := faker.NewWithSeed(rand.NewSource(seed))

// Generate first name first to advance the seed
f.faker.Person().FirstName()

// Generated last name that contains a double-quote (O"Keefe)
fakerLastName := f.faker.Person().LastName()

Expected behavior I would expect data generated from faker to only contain characters that are valid for that type of data. Because I would not expect double-quotes to be included in a person's name, I would replace those with single-quotes.

Additional context For developer environments in my org, we have seed data generated by the faker package fed into a service that also executes a set of validation rules against it. Because we have validation that restricts names, addresses, etc. to only valid characters, occasionally that data will fail validation due to the aforementioned double-quotes. This has been worked around by swapping double for single quotes when generating data where necessary.

Pull request opened to make this change: https://github.com/jaswdr/faker/pull/152

jaswdr commented 11 months ago

@mwgrimm thank you for the PR, I've approved and merged it, congrats 🎉

mwgrimm commented 11 months ago

@jaswdr Thanks for merging the PR! Would it make sense to make a new patch release for this change?