next-openapi-gen 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/zod-converter.js +14 -0
- package/package.json +1 -1
|
@@ -511,6 +511,20 @@ export class ZodSchemaConverter {
|
|
|
511
511
|
}
|
|
512
512
|
return this.processZodChain(node);
|
|
513
513
|
}
|
|
514
|
+
// Handle z.coerce.TYPE() patterns
|
|
515
|
+
if (t.isCallExpression(node) &&
|
|
516
|
+
t.isMemberExpression(node.callee) &&
|
|
517
|
+
t.isMemberExpression(node.callee.object) &&
|
|
518
|
+
t.isIdentifier(node.callee.object.object) &&
|
|
519
|
+
node.callee.object.object.name === "z" &&
|
|
520
|
+
t.isIdentifier(node.callee.object.property) &&
|
|
521
|
+
node.callee.object.property.name === "coerce" &&
|
|
522
|
+
t.isIdentifier(node.callee.property)) {
|
|
523
|
+
const coerceType = node.callee.property.name;
|
|
524
|
+
// Create a synthetic node for the underlying type using Babel types
|
|
525
|
+
const syntheticNode = t.callExpression(t.memberExpression(t.identifier("z"), t.identifier(coerceType)), []);
|
|
526
|
+
return this.processZodPrimitive(syntheticNode);
|
|
527
|
+
}
|
|
514
528
|
// Handle z.object({...})
|
|
515
529
|
if (t.isCallExpression(node) &&
|
|
516
530
|
t.isMemberExpression(node.callee) &&
|
package/package.json
CHANGED