-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support readonly()
#90
Comments
Same issue here. Does zod-to-json-schema/src/parsers/catch.ts Lines 1 to 7 in b8f2ac7
If it’s the latter, supporting UPD: This local patch seems to be working – I no longer get empty schemas 🎉 diff --git a/src/parseDef.js b/src/parseDef.js
index 4f33785322590999d31593cdcbdb174175930799..f8a09be4387cd64c1534f1f3a2a6c70f4625e1f2 100644
--- a/src/parseDef.js
+++ b/src/parseDef.js
@@ -151,6 +151,8 @@ const selectParser = (def, typeName, refs) => {
case zod_1.ZodFirstPartyTypeKind.ZodBranded:
return (0, branded_1.parseBrandedDef)(def, refs);
case zod_1.ZodFirstPartyTypeKind.ZodCatch:
+ // https://github.com/StefanTerdell/zod-to-json-schema/issues/90
+ case zod_1.ZodFirstPartyTypeKind.ZodReadonly:
return (0, catch_1.parseCatchDef)(def, refs);
case zod_1.ZodFirstPartyTypeKind.ZodPipeline:
return (0, pipeline_1.parsePipelineDef)(def, refs); For simplicity, |
Done in master |
When is this gonna be released @StefanTerdell ? |
@fredrikj31 about a minute ago |
Great, thanks @StefanTerdell! The new version works like a charm ✨ If you have a bit of time, can you please update the list of releases? It should help Renovate (and other similar tools) show the list changes in autogenerated PRs. It is empty at the moment: |
With zod 3.22.0+ we now have
.readonly()
which can be applied to various types, most notably array and object. This is not supported inzod-to-json-schema
yet, so it just returns an empty schema:The text was updated successfully, but these errors were encountered: