Southclaws / supervillain

Converts Go structs to Zod schemas
MIT License
76 stars 6 forks source link

Root array feature #17

Open mfolkeseth opened 1 month ago

mfolkeseth commented 1 month ago

Hello,

Thanks for making such a neat tool.

I was wondering if there is any possibility of adding a root array feature? Let med demonstrate.

Proposed signature and usage

func StructToZodArraySchema(input interface{}, name)

users := StructToZodArraySchema(User{}, 'Users')

(note plural)

export const UsersSchema = z.array(UserSchema)
Southclaws commented 1 month ago

Hey, thanks, glad it's useful!

Top level arrays make sense, though I don't actively use this library any more so I just review and accept PRs for features currently. It should be fairly easy to implement though!