The above PR addresses an issue where descriptions would not carry over to schemas created using the chaining helper methods, like .optional().
// Before the above changes
z.string().describe("a description").description // "a description"
z.string().describe("a description").optional().description // undefined
// After
z.string().describe("a description").description // "a description"
z.string().describe("a description").optional().description // "a description"
The changes to fix this issue were also applied to .array(), which results in some unexpected behavior.
// With this bug,
z.string().describe("a description").array()
// is equivalent to:
z.string().describe("a description").array().describe("a description")
// but this works as expected
z.array(z.string().describe("a description"))
Related to changes made in #1756.
The above PR addresses an issue where descriptions would not carry over to schemas created using the chaining helper methods, like
.optional()
.The changes to fix this issue were also applied to
.array()
, which results in some unexpected behavior.The fix was super simple, I'll open a PR shortly!