java-faker icon indicating copy to clipboard operation
java-faker copied to clipboard

Add CPF generation (identification number in Brazil like social security number)

Open eliasnogueira opened this issue 8 years ago • 8 comments

Added a CPF generator. CPF is a Brazilian social security number and I added it because it is commonly used in all applications that require a sign up. This feature will benefit a lot of testers in Brazil.

eliasnogueira avatar Oct 26 '17 01:10 eliasnogueira

Hello, I just cloned the project and I couldn't find the CPF class, despite this I've seen the class SwedishIdNumberTest, I suggest that we could have a TaxId ou TaxNumber class that would return valid numbers for each country, and there should be a method getTaxNumber() for Company too. If you're interested in this I could help.

murilotuvani avatar Jul 12 '18 14:07 murilotuvani

When can we expect this on the release?

abidkhan33 avatar May 11 '22 09:05 abidkhan33

@abidkhan33 this is already merged (and fixed, there's a bug in the PR) in our fork, Datafaker.net. It's a direct copy of this repo, the only thing you have to do is replace the dependency and the import.

bodiam avatar May 11 '22 09:05 bodiam

@bodiam you guys did what I was about to do: a fork to add serious data in a new library. Why don't you guys remove the kind of "garbage" they have from DataFaker.net? (like the TV shows, movies, and useless generators)

eliasnogueira avatar May 11 '22 09:05 eliasnogueira

@eliasnogueira Well, if you want to help us out, more than welcome. We're very open to PRs, and we release every month.

Regarding the amount of providers, it's a tricky thing to do. On one hand, those providers aren't for everyone, I understand that. On the other hand, the goal was to make it compatible with Javafaker as much as possible, the providers aren't really in the way, it's also more similar to the Rubyfaker like this, and believe it or not, some of these providers are even used by some people. There was the idea to make a datafaker-core, and optional datafaker-media module for example, but we just haven't got there yet.

So, don't know really. If they really bother you, there's some excellent alternatives out there which have less of these crazy things, like mockneat and https://github.com/arakelian/faker. They both look great, though I don't have much experience with them myself.

bodiam avatar May 11 '22 10:05 bodiam

Thanks @bodiam My expectation (which does not mean it will be fulfilled) is to have a library with really "serious/useful" data generation for business purposes. The idea of modules to extend it would be really nice and I am open to contributing in this sense. If you guys have issues for it, please ping me there, I will help :)

eliasnogueira avatar May 11 '22 12:05 eliasnogueira

@eliasnogueira thanks for that, appreciate it. Better to move this discussion over to datafaker I guess, but we do have custom fakers (https://www.datafaker.net/documentation/custom-providers/), but just no modular system yet. We don't have specific issues yet, nor do I like creating or assigning issues (it's not a job :-) ), but we're very open to the idea of having a more modular approach, in any way you see happening. So, if you want to create an issue and work on it, that would be awesome. I'd personally prefer to keep datafaker a mostly drop in replacement for javafaker, but I think that's possible while splitting things up a bit more, I could see that work.

bodiam avatar May 11 '22 13:05 bodiam

PS: thanks for the PR of the CPF! It's well and alive here: https://s01.oss.sonatype.org/service/local/repositories/releases/archive/net/datafaker/datafaker/1.3.0/datafaker-1.3.0-javadoc.jar/!/net/datafaker/CPF.html, including now a CNPJ generator.

bodiam avatar May 11 '22 14:05 bodiam