Hey folks! Came by to share a project I had long been strewing on and finally got around to implementing.
But before that a bit of background: I’ve been developing and contributing to open source for many years now and a couple years back when Valibot was still new I helped add support for third-party developers to introspect schemas and build integrations around them. The key motivator for that work was that I had previously been using Zod to describe Discord’s REST API and there was a handy library in its ecosystem to generate mock data from those schemas. That work on Valibot unblocked me to build Valimock, which uses FakerJS to generate mock data from your schemas.
So not long after learning about lexicons from Dan Abramov (and ATProto in general) sometime over a year ago, one of the first things that came to mind was that I wanted to have the same ability to generate mock data for ATProto apps as I was doing in Discordkit.
Well today I’m glad to share that now you can!
Valicon is a collection of Valibot actions, methods, and schemas that enable you to build lexicon schemas in Typescript, which you can use for runtime validation and get inferred Typescript type definitions. It even has some super handy codegen utilities for taking your existing lexicons and generating schemas from them and in the opposite direction from schema to JSON record as well! This means no re-writing your existing lexicons by hand: just use the fromLexicon() utility and you can then wire it into Valimock and immediately use it to generate mock data in your test suites.
It is built on the same functional and tree-shakeable architecture as Valibot, which aims to have a minimal footprint in your application bundles. And besides requiring Valibot as a peer, they otherwise bot have zero external dependencies!
Now, disclaimer: I did use Claude to build this library; however, I have held it to the same standards as all of the prior hand-authored work I’ve done in this space. It has a robust test-suite and conducts its codegen tests against the official ATProto interop test files to ensure bi-directional generation. It is however possible that due to being relatively new to developing for ATProto, I may not have caught subtle flaws in my review. Please file an issue if you encounter any bugs! PRs are welcome too.
Anyways, I hope you all find Valicon useful in your projects! Thanks for reading!