DEV Community

Cover image for Create ZOD schema generator app with GitHub Copilot CLI
Valiantsin Lutchanka
Valiantsin Lutchanka

Posted on

Create ZOD schema generator app with GitHub Copilot CLI

Hi folks!

Year ago, I have been playing out of curiosity with AI tools like Claude or ChatGPT to create some apps just for fun and to try what they are capable for. The results were not so impressive.

Days are past and now with all the progress that big AI players made I decided to give a second try to tools like cli agents.

I am heavily involved into API testing and as far as Zod has become my go-to library for schema validation, and writing Zod schemas from scratch can be tedious, especially for complex data structures, I decided to create a small app to generate ZOD schemas out of JSON responses and JSON schemas with GitHub Copilot CLI.

I do not have a GitHub subscription so I was suffering in a free tier mode with Haiku model :).

Surprisingly enough it was doing quite well and udnerstood the requirements quickly. I did not want to have a complex structure or use any frameworks, maybe this was a reason Haiku handled this task after some back and forwards, and errors fixing.

So the app was finally created using vanilla JS - all-in-one web page. And Copilot CLI even did not run out of free tier :).

The idea was simple - parse the users' input - if it is a normal JSON - generate ZOD schema using regex matchers. If users' input is a JSON schema - use the library to convert it to ZOD schema as a string.

The result is quite pleasant and at least useful for me (hope someone will find it useful as well).

This is how it looks like:

ZOD generator

You can try it live here:

What I took out of this?

Well - the AI is evolving quite fast, and tasks that before have been taking significant time and tokens to generate with more advanced models, now can be acomplished with much lesser efforts and with simplier models. But I am sure you all know this :)

It is very interesting were we will come with all this progress, and how it will look like in 1 year, especially with tools like BMAD or Beads.

Would be glad to hear about your experience, and what things you been creating with AI!

Top comments (0)