When a struct contains multiple levels of embedded or inline structs, the generated Zod schema didn't accurately represent the flattened structure that Go would produce when marshaling to JSON.
This PR modifies the convertStruct function to recursively process inline and embedded structs. The new convertStructFields function is introduced to handle the recursive traversal of struct fields, including those from inline structs.
I found an edge case during testing that I didn't cover in https://github.com/Southclaws/supervillain/pull/15.
When a struct contains multiple levels of embedded or inline structs, the generated Zod schema didn't accurately represent the flattened structure that Go would produce when marshaling to JSON.
This PR modifies the
convertStruct
function to recursively process inline and embedded structs. The newconvertStructFields
function is introduced to handle the recursive traversal of struct fields, including those from inline structs.