@hongminhee@hollo.social

2 replies

@mikebroberts@hachyderm.io · Reply to 洪 民憙 (Hong Minhee) :nonbinary:

@hongminhee I’m a recent zod convert. Still wrapping my head around when and when not to use transforms / codecs - but I very much like the combination of static and runtime type checking in one definition. I was using AJV in a couple of places before, but zod has won me over.

I don't have any CLI tools I'm working on at the moment, but will look at Optique if I do!

Update: Just added automatic metavar inference!

The help text now gets smarter labels based on your Zod schema:

  • z.string().email()EMAIL
  • z.coerce.number().int()INTEGER
  • z.enum([…])CHOICE

No manual configuration needed.

https://github.com/dahlia/optique/commit/d4903dfdb88727a488dedb6a73ad8997868246e1

Add metavar inference for Zod schemas · dahlia/optique@d4903df

Implement automatic metavar inference that analyzes Zod schema types to determine appropriate metavar strings for help text. The inference supports basic types (string, number, boolean, date), refi...