Hey everyone! I’ve been working on fakerz, a Zig library for generating fake data when you’re writing tests.
What’s the problem?
You know that moment when you’re writing tests and you need some random strings, fake IDs, or placeholder data? You end up either hardcoding “test123” everywhere or writing the same random generation code over and over. It gets old fast.
What’s fakerz?
It’s a simple library (inspired by the Faker cli/python package but with a zig twist obviously) that gives you functions to fill buffers with random data. Want 20 random letters? Done. Need some fake hex tokens? Easy. Working with 2D grids and need test data? Got you covered.
What’s the plan?
Right now it handles text generation pretty well - letters, digits, symbols, patterns, all that good stuff. But I’m just getting started. I want to add more stuff in the future
Short term:
More data formats (base64, CSV, JSON encoding)
Better documentation and examples
More utilities for common testing scenarios
Long term:
Realistic fake data (names, addresses, emails, phone numbers) (schema based)
Very neat project.
I had just recently the discovered original faker project via a Dreams of Code video, but figured the CLI version would be as helpful as it gets for me in practical terms, as I detest using Python for anything. Having it as a Zig library would be great for eliminating the crud of creating “real world” test data.
Thanks, and yes at some point I will make a cli too, but currently if you look at what is available, basically I only have a backend of useful functions, but I’m going to work on higher level construct, it’s going to take a bit of time, but I’ll figure it out. The long term goal is to provide a json schema based configuration, and have a sort of interpreter that generates fake data based on a schema. I will ship some premade one like, email, identity, url, etc etc, I’m not there yet, still a lot to figure out, but I’ll make sure to give regular update when I add some features
Nice, I look forward to seeing your progress.
You might also want to considered using ZON in addition to (or possibly even instead of?) JSON schemas. Just food for thought.
yeah obviously, later on I might, because I thought about it, but at least for the first kind of schema to support i think it ought to be something more well known than zon, and who knows maybe it will change slightly in the future