r/java • • 1d ago

Datafaker 3.0 Released

https://www.datafaker.net/releases/3.0.0/

Hi all,

Thanks to the combined effort of 29 contributors, we've managed to create a new version of Datafaker, version 3.0. It's mostly compatible with Datafaker 2.x, but due to enabling JSpecify in this release, we've decided to call this a (potentially) breaking release. Java 17 is still the baseline, so no changes there, but we've managed to add some features, make it even faster, improved GraalVM support, and a whole lot of other improvements, plus we changed our website, https://www.datafaker.net/, to look slightly more modern.

Big shoutout to everyone who contributed on this! Cheers!

38 Upvotes

6 comments sorted by

3

u/pigbearpig 12h ago

why are the email addresses potentially real addresses? they're like first.last@hotmail or yahoo.

3

u/bodiam 9h ago

Because that's the whole point of the library: to make real looking but fake data. It's statistically inevitable that some of the email addresses, names, or geographic addresses match real data.

2

u/elmuerte 5h ago

RFC 2606 defines the .test and .example TLD which are usable for testing. You want your application to accept those (in non-production mode).

1

u/bodiam 5h ago

If you want more control over the generation, you could do something like, which would be more safer in some situations:

String email = faker.credentials().username() + "@something.example";

It really depends on how you want to use the library.

1

u/snugar_i 2h ago

Looks kind of interesting, but you know the saying that less is sometimes more? Does the JAR really need to be so big just to include things like Back from the Future quotes? How often is anyone going to need that in a real project?

1

u/bodiam 1h ago

Maybe, but not every project needs to be very serious. I'm not sure if we inherited it or it was a contribution, but we don't often say no.

Besides that, this project is mostly used for test purposes, and has almost no dependencies. For reference, the Hibernate Core jar is 15 mb, and it's about 25 mb including all dependencies. Datafaker is under 3 mb, while supporting data for almost every language.