fullstacked 0.12.1-1371 → 0.12.2-1382

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.
Files changed (713) hide show
  1. package/fullstacked_modules/@types/archive/index.d.ts +33 -0
  2. package/fullstacked_modules/@types/connect/index.d.ts +28 -0
  3. package/fullstacked_modules/@types/fetch/index.d.ts +38 -0
  4. package/fullstacked_modules/@types/fs/index.d.ts +73 -0
  5. package/fullstacked_modules/@types/platform/index.d.ts +15 -0
  6. package/fullstacked_modules/{archive/archive.ts → archive.ts} +10 -3
  7. package/fullstacked_modules/{auto_update/index.ts → auto_update.ts} +4 -7
  8. package/fullstacked_modules/build/index.ts +108 -2
  9. package/fullstacked_modules/{connect/index.ts → connect.ts} +7 -7
  10. package/fullstacked_modules/{core_message/core_message.ts → core_message.ts} +7 -1
  11. package/fullstacked_modules/{fetch/index.ts → fetch.ts} +5 -6
  12. package/fullstacked_modules/{fs/fs.ts → fs.ts} +15 -2
  13. package/fullstacked_modules/{git/git.ts → git.ts} +24 -4
  14. package/fullstacked_modules/{packages/packages.ts → packages.ts} +10 -7
  15. package/index.js +2 -8
  16. package/package.json +1 -1
  17. package/fullstacked_modules/@fullstacked/ai-agent/README.md +0 -1
  18. package/fullstacked_modules/@fullstacked/ai-agent/ai-agent.js +0 -192588
  19. package/fullstacked_modules/@fullstacked/ai-agent/index.scss +0 -15
  20. package/fullstacked_modules/@fullstacked/ai-agent/index.ts +0 -111
  21. package/fullstacked_modules/@fullstacked/ai-agent/lock.json +0 -1176
  22. package/fullstacked_modules/@fullstacked/ai-agent/package.json +0 -28
  23. package/fullstacked_modules/@fullstacked/ai-agent/src/conversation.ts +0 -227
  24. package/fullstacked_modules/@fullstacked/ai-agent/src/default.scss +0 -23
  25. package/fullstacked_modules/@fullstacked/ai-agent/src/index.ts +0 -2
  26. package/fullstacked_modules/@fullstacked/ai-agent/src/input.ts +0 -36
  27. package/fullstacked_modules/@fullstacked/ai-agent/src/markdown.ts +0 -50
  28. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/anthropic.ts +0 -50
  29. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/deepseek.ts +0 -50
  30. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/google.ts +0 -44
  31. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/index.ts +0 -39
  32. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/interface.ts +0 -29
  33. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/mistral.ts +0 -51
  34. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/ollama.ts +0 -70
  35. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/openai.ts +0 -49
  36. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/xai.ts +0 -47
  37. package/fullstacked_modules/ai/index.d.ts +0 -3
  38. package/fullstacked_modules/ai/index.ts +0 -14
  39. package/fullstacked_modules/ai/tools/fs.ts +0 -70
  40. package/fullstacked_modules/archive/index.d.ts +0 -3
  41. package/fullstacked_modules/archive/index.ts +0 -3
  42. package/fullstacked_modules/bridge/index.d.ts +0 -0
  43. package/fullstacked_modules/build/build.ts +0 -101
  44. package/fullstacked_modules/build/index.d.ts +0 -0
  45. package/fullstacked_modules/components/index.d.ts +0 -0
  46. package/fullstacked_modules/connect/index.d.ts +0 -3
  47. package/fullstacked_modules/core_message/index.d.ts +0 -0
  48. package/fullstacked_modules/core_message/index.ts +0 -3
  49. package/fullstacked_modules/fetch/index.d.ts +0 -3
  50. package/fullstacked_modules/fs/index.d.ts +0 -3
  51. package/fullstacked_modules/fs/index.ts +0 -3
  52. package/fullstacked_modules/git/index.d.ts +0 -0
  53. package/fullstacked_modules/git/index.ts +0 -3
  54. package/fullstacked_modules/packages/index.d.ts +0 -0
  55. package/fullstacked_modules/packages/index.ts +0 -3
  56. package/fullstacked_modules/platform/index.d.ts +0 -3
  57. package/fullstacked_modules/zod/LICENSE +0 -21
  58. package/fullstacked_modules/zod/README.md +0 -208
  59. package/fullstacked_modules/zod/index.cjs +0 -33
  60. package/fullstacked_modules/zod/index.d.cts +0 -4
  61. package/fullstacked_modules/zod/index.d.ts +0 -4
  62. package/fullstacked_modules/zod/index.js +0 -4
  63. package/fullstacked_modules/zod/locales/index.cjs +0 -17
  64. package/fullstacked_modules/zod/locales/index.d.cts +0 -1
  65. package/fullstacked_modules/zod/locales/index.d.ts +0 -1
  66. package/fullstacked_modules/zod/locales/index.js +0 -1
  67. package/fullstacked_modules/zod/locales/package.json +0 -6
  68. package/fullstacked_modules/zod/mini/index.cjs +0 -17
  69. package/fullstacked_modules/zod/mini/index.d.cts +0 -1
  70. package/fullstacked_modules/zod/mini/index.d.ts +0 -1
  71. package/fullstacked_modules/zod/mini/index.js +0 -1
  72. package/fullstacked_modules/zod/mini/package.json +0 -6
  73. package/fullstacked_modules/zod/package.json +0 -135
  74. package/fullstacked_modules/zod/src/index.ts +0 -4
  75. package/fullstacked_modules/zod/src/locales/index.ts +0 -1
  76. package/fullstacked_modules/zod/src/mini/index.ts +0 -1
  77. package/fullstacked_modules/zod/src/v3/ZodError.ts +0 -330
  78. package/fullstacked_modules/zod/src/v3/benchmarks/datetime.ts +0 -58
  79. package/fullstacked_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +0 -80
  80. package/fullstacked_modules/zod/src/v3/benchmarks/index.ts +0 -59
  81. package/fullstacked_modules/zod/src/v3/benchmarks/ipv4.ts +0 -57
  82. package/fullstacked_modules/zod/src/v3/benchmarks/object.ts +0 -69
  83. package/fullstacked_modules/zod/src/v3/benchmarks/primitives.ts +0 -162
  84. package/fullstacked_modules/zod/src/v3/benchmarks/realworld.ts +0 -63
  85. package/fullstacked_modules/zod/src/v3/benchmarks/string.ts +0 -55
  86. package/fullstacked_modules/zod/src/v3/benchmarks/union.ts +0 -80
  87. package/fullstacked_modules/zod/src/v3/errors.ts +0 -13
  88. package/fullstacked_modules/zod/src/v3/external.ts +0 -6
  89. package/fullstacked_modules/zod/src/v3/helpers/enumUtil.ts +0 -17
  90. package/fullstacked_modules/zod/src/v3/helpers/errorUtil.ts +0 -8
  91. package/fullstacked_modules/zod/src/v3/helpers/parseUtil.ts +0 -176
  92. package/fullstacked_modules/zod/src/v3/helpers/partialUtil.ts +0 -34
  93. package/fullstacked_modules/zod/src/v3/helpers/typeAliases.ts +0 -2
  94. package/fullstacked_modules/zod/src/v3/helpers/util.ts +0 -224
  95. package/fullstacked_modules/zod/src/v3/index.ts +0 -4
  96. package/fullstacked_modules/zod/src/v3/locales/en.ts +0 -124
  97. package/fullstacked_modules/zod/src/v3/standard-schema.ts +0 -113
  98. package/fullstacked_modules/zod/src/v3/tests/Mocker.ts +0 -54
  99. package/fullstacked_modules/zod/src/v3/tests/all-errors.test.ts +0 -157
  100. package/fullstacked_modules/zod/src/v3/tests/anyunknown.test.ts +0 -28
  101. package/fullstacked_modules/zod/src/v3/tests/array.test.ts +0 -71
  102. package/fullstacked_modules/zod/src/v3/tests/async-parsing.test.ts +0 -388
  103. package/fullstacked_modules/zod/src/v3/tests/async-refinements.test.ts +0 -46
  104. package/fullstacked_modules/zod/src/v3/tests/base.test.ts +0 -29
  105. package/fullstacked_modules/zod/src/v3/tests/bigint.test.ts +0 -55
  106. package/fullstacked_modules/zod/src/v3/tests/branded.test.ts +0 -53
  107. package/fullstacked_modules/zod/src/v3/tests/catch.test.ts +0 -220
  108. package/fullstacked_modules/zod/src/v3/tests/coerce.test.ts +0 -133
  109. package/fullstacked_modules/zod/src/v3/tests/complex.test.ts +0 -56
  110. package/fullstacked_modules/zod/src/v3/tests/custom.test.ts +0 -31
  111. package/fullstacked_modules/zod/src/v3/tests/date.test.ts +0 -32
  112. package/fullstacked_modules/zod/src/v3/tests/deepmasking.test.ts +0 -186
  113. package/fullstacked_modules/zod/src/v3/tests/default.test.ts +0 -112
  114. package/fullstacked_modules/zod/src/v3/tests/description.test.ts +0 -33
  115. package/fullstacked_modules/zod/src/v3/tests/discriminated-unions.test.ts +0 -315
  116. package/fullstacked_modules/zod/src/v3/tests/enum.test.ts +0 -80
  117. package/fullstacked_modules/zod/src/v3/tests/error.test.ts +0 -551
  118. package/fullstacked_modules/zod/src/v3/tests/firstparty.test.ts +0 -87
  119. package/fullstacked_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +0 -21
  120. package/fullstacked_modules/zod/src/v3/tests/function.test.ts +0 -257
  121. package/fullstacked_modules/zod/src/v3/tests/generics.test.ts +0 -48
  122. package/fullstacked_modules/zod/src/v3/tests/instanceof.test.ts +0 -37
  123. package/fullstacked_modules/zod/src/v3/tests/intersection.test.ts +0 -110
  124. package/fullstacked_modules/zod/src/v3/tests/language-server.source.ts +0 -76
  125. package/fullstacked_modules/zod/src/v3/tests/language-server.test.ts +0 -207
  126. package/fullstacked_modules/zod/src/v3/tests/literal.test.ts +0 -36
  127. package/fullstacked_modules/zod/src/v3/tests/map.test.ts +0 -110
  128. package/fullstacked_modules/zod/src/v3/tests/masking.test.ts +0 -4
  129. package/fullstacked_modules/zod/src/v3/tests/mocker.test.ts +0 -19
  130. package/fullstacked_modules/zod/src/v3/tests/nan.test.ts +0 -21
  131. package/fullstacked_modules/zod/src/v3/tests/nativeEnum.test.ts +0 -87
  132. package/fullstacked_modules/zod/src/v3/tests/nullable.test.ts +0 -42
  133. package/fullstacked_modules/zod/src/v3/tests/number.test.ts +0 -176
  134. package/fullstacked_modules/zod/src/v3/tests/object-augmentation.test.ts +0 -29
  135. package/fullstacked_modules/zod/src/v3/tests/object-in-es5-env.test.ts +0 -29
  136. package/fullstacked_modules/zod/src/v3/tests/object.test.ts +0 -434
  137. package/fullstacked_modules/zod/src/v3/tests/optional.test.ts +0 -42
  138. package/fullstacked_modules/zod/src/v3/tests/parseUtil.test.ts +0 -23
  139. package/fullstacked_modules/zod/src/v3/tests/parser.test.ts +0 -41
  140. package/fullstacked_modules/zod/src/v3/tests/partials.test.ts +0 -243
  141. package/fullstacked_modules/zod/src/v3/tests/pickomit.test.ts +0 -111
  142. package/fullstacked_modules/zod/src/v3/tests/pipeline.test.ts +0 -29
  143. package/fullstacked_modules/zod/src/v3/tests/preprocess.test.ts +0 -186
  144. package/fullstacked_modules/zod/src/v3/tests/primitive.test.ts +0 -440
  145. package/fullstacked_modules/zod/src/v3/tests/promise.test.ts +0 -90
  146. package/fullstacked_modules/zod/src/v3/tests/readonly.test.ts +0 -194
  147. package/fullstacked_modules/zod/src/v3/tests/record.test.ts +0 -171
  148. package/fullstacked_modules/zod/src/v3/tests/recursive.test.ts +0 -197
  149. package/fullstacked_modules/zod/src/v3/tests/refine.test.ts +0 -313
  150. package/fullstacked_modules/zod/src/v3/tests/safeparse.test.ts +0 -27
  151. package/fullstacked_modules/zod/src/v3/tests/set.test.ts +0 -142
  152. package/fullstacked_modules/zod/src/v3/tests/standard-schema.test.ts +0 -83
  153. package/fullstacked_modules/zod/src/v3/tests/string.test.ts +0 -916
  154. package/fullstacked_modules/zod/src/v3/tests/transformer.test.ts +0 -233
  155. package/fullstacked_modules/zod/src/v3/tests/tuple.test.ts +0 -90
  156. package/fullstacked_modules/zod/src/v3/tests/unions.test.ts +0 -57
  157. package/fullstacked_modules/zod/src/v3/tests/validations.test.ts +0 -133
  158. package/fullstacked_modules/zod/src/v3/tests/void.test.ts +0 -15
  159. package/fullstacked_modules/zod/src/v3/types.ts +0 -5138
  160. package/fullstacked_modules/zod/src/v4/classic/checks.ts +0 -31
  161. package/fullstacked_modules/zod/src/v4/classic/coerce.ts +0 -27
  162. package/fullstacked_modules/zod/src/v4/classic/compat.ts +0 -70
  163. package/fullstacked_modules/zod/src/v4/classic/errors.ts +0 -82
  164. package/fullstacked_modules/zod/src/v4/classic/external.ts +0 -50
  165. package/fullstacked_modules/zod/src/v4/classic/index.ts +0 -5
  166. package/fullstacked_modules/zod/src/v4/classic/iso.ts +0 -90
  167. package/fullstacked_modules/zod/src/v4/classic/parse.ts +0 -82
  168. package/fullstacked_modules/zod/src/v4/classic/schemas.ts +0 -2197
  169. package/fullstacked_modules/zod/src/v4/classic/tests/anyunknown.test.ts +0 -26
  170. package/fullstacked_modules/zod/src/v4/classic/tests/array.test.ts +0 -264
  171. package/fullstacked_modules/zod/src/v4/classic/tests/assignability.test.ts +0 -210
  172. package/fullstacked_modules/zod/src/v4/classic/tests/async-parsing.test.ts +0 -381
  173. package/fullstacked_modules/zod/src/v4/classic/tests/async-refinements.test.ts +0 -68
  174. package/fullstacked_modules/zod/src/v4/classic/tests/base.test.ts +0 -7
  175. package/fullstacked_modules/zod/src/v4/classic/tests/bigint.test.ts +0 -54
  176. package/fullstacked_modules/zod/src/v4/classic/tests/brand.test.ts +0 -63
  177. package/fullstacked_modules/zod/src/v4/classic/tests/catch.test.ts +0 -276
  178. package/fullstacked_modules/zod/src/v4/classic/tests/coalesce.test.ts +0 -20
  179. package/fullstacked_modules/zod/src/v4/classic/tests/codec-examples.test.ts +0 -573
  180. package/fullstacked_modules/zod/src/v4/classic/tests/codec.test.ts +0 -562
  181. package/fullstacked_modules/zod/src/v4/classic/tests/coerce.test.ts +0 -160
  182. package/fullstacked_modules/zod/src/v4/classic/tests/continuability.test.ts +0 -352
  183. package/fullstacked_modules/zod/src/v4/classic/tests/custom.test.ts +0 -40
  184. package/fullstacked_modules/zod/src/v4/classic/tests/date.test.ts +0 -31
  185. package/fullstacked_modules/zod/src/v4/classic/tests/datetime.test.ts +0 -302
  186. package/fullstacked_modules/zod/src/v4/classic/tests/default.test.ts +0 -365
  187. package/fullstacked_modules/zod/src/v4/classic/tests/description.test.ts +0 -32
  188. package/fullstacked_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +0 -661
  189. package/fullstacked_modules/zod/src/v4/classic/tests/enum.test.ts +0 -285
  190. package/fullstacked_modules/zod/src/v4/classic/tests/error-utils.test.ts +0 -595
  191. package/fullstacked_modules/zod/src/v4/classic/tests/error.test.ts +0 -711
  192. package/fullstacked_modules/zod/src/v4/classic/tests/file.test.ts +0 -96
  193. package/fullstacked_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -179
  194. package/fullstacked_modules/zod/src/v4/classic/tests/function.test.ts +0 -308
  195. package/fullstacked_modules/zod/src/v4/classic/tests/generics.test.ts +0 -72
  196. package/fullstacked_modules/zod/src/v4/classic/tests/hash.test.ts +0 -68
  197. package/fullstacked_modules/zod/src/v4/classic/tests/index.test.ts +0 -844
  198. package/fullstacked_modules/zod/src/v4/classic/tests/instanceof.test.ts +0 -34
  199. package/fullstacked_modules/zod/src/v4/classic/tests/intersection.test.ts +0 -171
  200. package/fullstacked_modules/zod/src/v4/classic/tests/json.test.ts +0 -108
  201. package/fullstacked_modules/zod/src/v4/classic/tests/lazy.test.ts +0 -227
  202. package/fullstacked_modules/zod/src/v4/classic/tests/literal.test.ts +0 -117
  203. package/fullstacked_modules/zod/src/v4/classic/tests/map.test.ts +0 -196
  204. package/fullstacked_modules/zod/src/v4/classic/tests/nan.test.ts +0 -21
  205. package/fullstacked_modules/zod/src/v4/classic/tests/nested-refine.test.ts +0 -168
  206. package/fullstacked_modules/zod/src/v4/classic/tests/nonoptional.test.ts +0 -101
  207. package/fullstacked_modules/zod/src/v4/classic/tests/nullable.test.ts +0 -22
  208. package/fullstacked_modules/zod/src/v4/classic/tests/number.test.ts +0 -270
  209. package/fullstacked_modules/zod/src/v4/classic/tests/object.test.ts +0 -609
  210. package/fullstacked_modules/zod/src/v4/classic/tests/optional.test.ts +0 -136
  211. package/fullstacked_modules/zod/src/v4/classic/tests/partial.test.ts +0 -340
  212. package/fullstacked_modules/zod/src/v4/classic/tests/pickomit.test.ts +0 -127
  213. package/fullstacked_modules/zod/src/v4/classic/tests/pipe.test.ts +0 -101
  214. package/fullstacked_modules/zod/src/v4/classic/tests/prefault.test.ts +0 -74
  215. package/fullstacked_modules/zod/src/v4/classic/tests/preprocess.test.ts +0 -282
  216. package/fullstacked_modules/zod/src/v4/classic/tests/primitive.test.ts +0 -175
  217. package/fullstacked_modules/zod/src/v4/classic/tests/promise.test.ts +0 -81
  218. package/fullstacked_modules/zod/src/v4/classic/tests/prototypes.test.ts +0 -23
  219. package/fullstacked_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -252
  220. package/fullstacked_modules/zod/src/v4/classic/tests/record.test.ts +0 -356
  221. package/fullstacked_modules/zod/src/v4/classic/tests/recursive-types.test.ts +0 -582
  222. package/fullstacked_modules/zod/src/v4/classic/tests/refine.test.ts +0 -605
  223. package/fullstacked_modules/zod/src/v4/classic/tests/registries.test.ts +0 -204
  224. package/fullstacked_modules/zod/src/v4/classic/tests/set.test.ts +0 -181
  225. package/fullstacked_modules/zod/src/v4/classic/tests/standard-schema.test.ts +0 -57
  226. package/fullstacked_modules/zod/src/v4/classic/tests/string-formats.test.ts +0 -125
  227. package/fullstacked_modules/zod/src/v4/classic/tests/string.test.ts +0 -1080
  228. package/fullstacked_modules/zod/src/v4/classic/tests/stringbool.test.ts +0 -106
  229. package/fullstacked_modules/zod/src/v4/classic/tests/template-literal.test.ts +0 -763
  230. package/fullstacked_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +0 -2622
  231. package/fullstacked_modules/zod/src/v4/classic/tests/transform.test.ts +0 -361
  232. package/fullstacked_modules/zod/src/v4/classic/tests/tuple.test.ts +0 -163
  233. package/fullstacked_modules/zod/src/v4/classic/tests/union.test.ts +0 -181
  234. package/fullstacked_modules/zod/src/v4/classic/tests/validations.test.ts +0 -283
  235. package/fullstacked_modules/zod/src/v4/classic/tests/void.test.ts +0 -12
  236. package/fullstacked_modules/zod/src/v4/core/api.ts +0 -1621
  237. package/fullstacked_modules/zod/src/v4/core/checks.ts +0 -1287
  238. package/fullstacked_modules/zod/src/v4/core/config.ts +0 -15
  239. package/fullstacked_modules/zod/src/v4/core/core.ts +0 -115
  240. package/fullstacked_modules/zod/src/v4/core/doc.ts +0 -44
  241. package/fullstacked_modules/zod/src/v4/core/errors.ts +0 -413
  242. package/fullstacked_modules/zod/src/v4/core/index.ts +0 -14
  243. package/fullstacked_modules/zod/src/v4/core/json-schema.ts +0 -147
  244. package/fullstacked_modules/zod/src/v4/core/parse.ts +0 -195
  245. package/fullstacked_modules/zod/src/v4/core/regexes.ts +0 -177
  246. package/fullstacked_modules/zod/src/v4/core/registries.ts +0 -97
  247. package/fullstacked_modules/zod/src/v4/core/schemas.ts +0 -4317
  248. package/fullstacked_modules/zod/src/v4/core/standard-schema.ts +0 -64
  249. package/fullstacked_modules/zod/src/v4/core/tests/extend.test.ts +0 -18
  250. package/fullstacked_modules/zod/src/v4/core/tests/index.test.ts +0 -46
  251. package/fullstacked_modules/zod/src/v4/core/tests/locales/be.test.ts +0 -124
  252. package/fullstacked_modules/zod/src/v4/core/tests/locales/en.test.ts +0 -22
  253. package/fullstacked_modules/zod/src/v4/core/tests/locales/es.test.ts +0 -181
  254. package/fullstacked_modules/zod/src/v4/core/tests/locales/ru.test.ts +0 -128
  255. package/fullstacked_modules/zod/src/v4/core/tests/locales/tr.test.ts +0 -69
  256. package/fullstacked_modules/zod/src/v4/core/to-json-schema.ts +0 -1044
  257. package/fullstacked_modules/zod/src/v4/core/util.ts +0 -910
  258. package/fullstacked_modules/zod/src/v4/core/versions.ts +0 -5
  259. package/fullstacked_modules/zod/src/v4/core/zsf.ts +0 -323
  260. package/fullstacked_modules/zod/src/v4/index.ts +0 -4
  261. package/fullstacked_modules/zod/src/v4/locales/ar.ts +0 -125
  262. package/fullstacked_modules/zod/src/v4/locales/az.ts +0 -121
  263. package/fullstacked_modules/zod/src/v4/locales/be.ts +0 -184
  264. package/fullstacked_modules/zod/src/v4/locales/bg.ts +0 -136
  265. package/fullstacked_modules/zod/src/v4/locales/ca.ts +0 -127
  266. package/fullstacked_modules/zod/src/v4/locales/cs.ts +0 -142
  267. package/fullstacked_modules/zod/src/v4/locales/da.ts +0 -141
  268. package/fullstacked_modules/zod/src/v4/locales/de.ts +0 -124
  269. package/fullstacked_modules/zod/src/v4/locales/en.ts +0 -127
  270. package/fullstacked_modules/zod/src/v4/locales/eo.ts +0 -125
  271. package/fullstacked_modules/zod/src/v4/locales/es.ts +0 -159
  272. package/fullstacked_modules/zod/src/v4/locales/fa.ts +0 -134
  273. package/fullstacked_modules/zod/src/v4/locales/fi.ts +0 -131
  274. package/fullstacked_modules/zod/src/v4/locales/fr-CA.ts +0 -126
  275. package/fullstacked_modules/zod/src/v4/locales/fr.ts +0 -124
  276. package/fullstacked_modules/zod/src/v4/locales/he.ts +0 -125
  277. package/fullstacked_modules/zod/src/v4/locales/hu.ts +0 -126
  278. package/fullstacked_modules/zod/src/v4/locales/id.ts +0 -125
  279. package/fullstacked_modules/zod/src/v4/locales/index.ts +0 -47
  280. package/fullstacked_modules/zod/src/v4/locales/is.ts +0 -127
  281. package/fullstacked_modules/zod/src/v4/locales/it.ts +0 -125
  282. package/fullstacked_modules/zod/src/v4/locales/ja.ts +0 -122
  283. package/fullstacked_modules/zod/src/v4/locales/ka.ts +0 -138
  284. package/fullstacked_modules/zod/src/v4/locales/kh.ts +0 -7
  285. package/fullstacked_modules/zod/src/v4/locales/km.ts +0 -126
  286. package/fullstacked_modules/zod/src/v4/locales/ko.ts +0 -131
  287. package/fullstacked_modules/zod/src/v4/locales/lt.ts +0 -265
  288. package/fullstacked_modules/zod/src/v4/locales/mk.ts +0 -127
  289. package/fullstacked_modules/zod/src/v4/locales/ms.ts +0 -124
  290. package/fullstacked_modules/zod/src/v4/locales/nl.ts +0 -126
  291. package/fullstacked_modules/zod/src/v4/locales/no.ts +0 -124
  292. package/fullstacked_modules/zod/src/v4/locales/ota.ts +0 -125
  293. package/fullstacked_modules/zod/src/v4/locales/pl.ts +0 -126
  294. package/fullstacked_modules/zod/src/v4/locales/ps.ts +0 -133
  295. package/fullstacked_modules/zod/src/v4/locales/pt.ts +0 -123
  296. package/fullstacked_modules/zod/src/v4/locales/ru.ts +0 -184
  297. package/fullstacked_modules/zod/src/v4/locales/sl.ts +0 -126
  298. package/fullstacked_modules/zod/src/v4/locales/sv.ts +0 -127
  299. package/fullstacked_modules/zod/src/v4/locales/ta.ts +0 -125
  300. package/fullstacked_modules/zod/src/v4/locales/th.ts +0 -126
  301. package/fullstacked_modules/zod/src/v4/locales/tr.ts +0 -121
  302. package/fullstacked_modules/zod/src/v4/locales/ua.ts +0 -7
  303. package/fullstacked_modules/zod/src/v4/locales/uk.ts +0 -126
  304. package/fullstacked_modules/zod/src/v4/locales/ur.ts +0 -126
  305. package/fullstacked_modules/zod/src/v4/locales/vi.ts +0 -125
  306. package/fullstacked_modules/zod/src/v4/locales/yo.ts +0 -131
  307. package/fullstacked_modules/zod/src/v4/locales/zh-CN.ts +0 -123
  308. package/fullstacked_modules/zod/src/v4/locales/zh-TW.ts +0 -125
  309. package/fullstacked_modules/zod/src/v4/mini/checks.ts +0 -32
  310. package/fullstacked_modules/zod/src/v4/mini/coerce.ts +0 -22
  311. package/fullstacked_modules/zod/src/v4/mini/external.ts +0 -40
  312. package/fullstacked_modules/zod/src/v4/mini/index.ts +0 -3
  313. package/fullstacked_modules/zod/src/v4/mini/iso.ts +0 -62
  314. package/fullstacked_modules/zod/src/v4/mini/parse.ts +0 -14
  315. package/fullstacked_modules/zod/src/v4/mini/schemas.ts +0 -1725
  316. package/fullstacked_modules/zod/src/v4/mini/tests/assignability.test.ts +0 -129
  317. package/fullstacked_modules/zod/src/v4/mini/tests/brand.test.ts +0 -51
  318. package/fullstacked_modules/zod/src/v4/mini/tests/checks.test.ts +0 -144
  319. package/fullstacked_modules/zod/src/v4/mini/tests/codec.test.ts +0 -529
  320. package/fullstacked_modules/zod/src/v4/mini/tests/computed.test.ts +0 -36
  321. package/fullstacked_modules/zod/src/v4/mini/tests/error.test.ts +0 -22
  322. package/fullstacked_modules/zod/src/v4/mini/tests/functions.test.ts +0 -43
  323. package/fullstacked_modules/zod/src/v4/mini/tests/index.test.ts +0 -899
  324. package/fullstacked_modules/zod/src/v4/mini/tests/number.test.ts +0 -95
  325. package/fullstacked_modules/zod/src/v4/mini/tests/object.test.ts +0 -200
  326. package/fullstacked_modules/zod/src/v4/mini/tests/prototypes.test.ts +0 -43
  327. package/fullstacked_modules/zod/src/v4/mini/tests/recursive-types.test.ts +0 -275
  328. package/fullstacked_modules/zod/src/v4/mini/tests/string.test.ts +0 -315
  329. package/fullstacked_modules/zod/src/v4-mini/index.ts +0 -1
  330. package/fullstacked_modules/zod/v3/ZodError.cjs +0 -138
  331. package/fullstacked_modules/zod/v3/ZodError.d.cts +0 -164
  332. package/fullstacked_modules/zod/v3/ZodError.d.ts +0 -164
  333. package/fullstacked_modules/zod/v3/ZodError.js +0 -133
  334. package/fullstacked_modules/zod/v3/errors.cjs +0 -17
  335. package/fullstacked_modules/zod/v3/errors.d.cts +0 -5
  336. package/fullstacked_modules/zod/v3/errors.d.ts +0 -5
  337. package/fullstacked_modules/zod/v3/errors.js +0 -9
  338. package/fullstacked_modules/zod/v3/external.cjs +0 -22
  339. package/fullstacked_modules/zod/v3/external.d.cts +0 -6
  340. package/fullstacked_modules/zod/v3/external.d.ts +0 -6
  341. package/fullstacked_modules/zod/v3/external.js +0 -6
  342. package/fullstacked_modules/zod/v3/helpers/enumUtil.cjs +0 -2
  343. package/fullstacked_modules/zod/v3/helpers/enumUtil.d.cts +0 -8
  344. package/fullstacked_modules/zod/v3/helpers/enumUtil.d.ts +0 -8
  345. package/fullstacked_modules/zod/v3/helpers/enumUtil.js +0 -1
  346. package/fullstacked_modules/zod/v3/helpers/errorUtil.cjs +0 -9
  347. package/fullstacked_modules/zod/v3/helpers/errorUtil.d.cts +0 -9
  348. package/fullstacked_modules/zod/v3/helpers/errorUtil.d.ts +0 -9
  349. package/fullstacked_modules/zod/v3/helpers/errorUtil.js +0 -6
  350. package/fullstacked_modules/zod/v3/helpers/parseUtil.cjs +0 -124
  351. package/fullstacked_modules/zod/v3/helpers/parseUtil.d.cts +0 -78
  352. package/fullstacked_modules/zod/v3/helpers/parseUtil.d.ts +0 -78
  353. package/fullstacked_modules/zod/v3/helpers/parseUtil.js +0 -109
  354. package/fullstacked_modules/zod/v3/helpers/partialUtil.cjs +0 -2
  355. package/fullstacked_modules/zod/v3/helpers/partialUtil.d.cts +0 -8
  356. package/fullstacked_modules/zod/v3/helpers/partialUtil.d.ts +0 -8
  357. package/fullstacked_modules/zod/v3/helpers/partialUtil.js +0 -1
  358. package/fullstacked_modules/zod/v3/helpers/typeAliases.cjs +0 -2
  359. package/fullstacked_modules/zod/v3/helpers/typeAliases.d.cts +0 -2
  360. package/fullstacked_modules/zod/v3/helpers/typeAliases.d.ts +0 -2
  361. package/fullstacked_modules/zod/v3/helpers/typeAliases.js +0 -1
  362. package/fullstacked_modules/zod/v3/helpers/util.cjs +0 -137
  363. package/fullstacked_modules/zod/v3/helpers/util.d.cts +0 -85
  364. package/fullstacked_modules/zod/v3/helpers/util.d.ts +0 -85
  365. package/fullstacked_modules/zod/v3/helpers/util.js +0 -133
  366. package/fullstacked_modules/zod/v3/index.cjs +0 -33
  367. package/fullstacked_modules/zod/v3/index.d.cts +0 -4
  368. package/fullstacked_modules/zod/v3/index.d.ts +0 -4
  369. package/fullstacked_modules/zod/v3/index.js +0 -4
  370. package/fullstacked_modules/zod/v3/locales/en.cjs +0 -112
  371. package/fullstacked_modules/zod/v3/locales/en.d.cts +0 -3
  372. package/fullstacked_modules/zod/v3/locales/en.d.ts +0 -3
  373. package/fullstacked_modules/zod/v3/locales/en.js +0 -109
  374. package/fullstacked_modules/zod/v3/package.json +0 -6
  375. package/fullstacked_modules/zod/v3/standard-schema.cjs +0 -2
  376. package/fullstacked_modules/zod/v3/standard-schema.d.cts +0 -102
  377. package/fullstacked_modules/zod/v3/standard-schema.d.ts +0 -102
  378. package/fullstacked_modules/zod/v3/standard-schema.js +0 -1
  379. package/fullstacked_modules/zod/v3/types.cjs +0 -3777
  380. package/fullstacked_modules/zod/v3/types.d.cts +0 -1034
  381. package/fullstacked_modules/zod/v3/types.d.ts +0 -1034
  382. package/fullstacked_modules/zod/v3/types.js +0 -3695
  383. package/fullstacked_modules/zod/v4/classic/checks.cjs +0 -32
  384. package/fullstacked_modules/zod/v4/classic/checks.d.cts +0 -1
  385. package/fullstacked_modules/zod/v4/classic/checks.d.ts +0 -1
  386. package/fullstacked_modules/zod/v4/classic/checks.js +0 -1
  387. package/fullstacked_modules/zod/v4/classic/coerce.cjs +0 -47
  388. package/fullstacked_modules/zod/v4/classic/coerce.d.cts +0 -17
  389. package/fullstacked_modules/zod/v4/classic/coerce.d.ts +0 -17
  390. package/fullstacked_modules/zod/v4/classic/coerce.js +0 -17
  391. package/fullstacked_modules/zod/v4/classic/compat.cjs +0 -61
  392. package/fullstacked_modules/zod/v4/classic/compat.d.cts +0 -50
  393. package/fullstacked_modules/zod/v4/classic/compat.d.ts +0 -50
  394. package/fullstacked_modules/zod/v4/classic/compat.js +0 -31
  395. package/fullstacked_modules/zod/v4/classic/errors.cjs +0 -74
  396. package/fullstacked_modules/zod/v4/classic/errors.d.cts +0 -30
  397. package/fullstacked_modules/zod/v4/classic/errors.d.ts +0 -30
  398. package/fullstacked_modules/zod/v4/classic/errors.js +0 -48
  399. package/fullstacked_modules/zod/v4/classic/external.cjs +0 -70
  400. package/fullstacked_modules/zod/v4/classic/external.d.cts +0 -13
  401. package/fullstacked_modules/zod/v4/classic/external.d.ts +0 -13
  402. package/fullstacked_modules/zod/v4/classic/external.js +0 -18
  403. package/fullstacked_modules/zod/v4/classic/index.cjs +0 -33
  404. package/fullstacked_modules/zod/v4/classic/index.d.cts +0 -4
  405. package/fullstacked_modules/zod/v4/classic/index.d.ts +0 -4
  406. package/fullstacked_modules/zod/v4/classic/index.js +0 -4
  407. package/fullstacked_modules/zod/v4/classic/iso.cjs +0 -60
  408. package/fullstacked_modules/zod/v4/classic/iso.d.cts +0 -22
  409. package/fullstacked_modules/zod/v4/classic/iso.d.ts +0 -22
  410. package/fullstacked_modules/zod/v4/classic/iso.js +0 -30
  411. package/fullstacked_modules/zod/v4/classic/package.json +0 -6
  412. package/fullstacked_modules/zod/v4/classic/parse.cjs +0 -41
  413. package/fullstacked_modules/zod/v4/classic/parse.d.cts +0 -31
  414. package/fullstacked_modules/zod/v4/classic/parse.d.ts +0 -31
  415. package/fullstacked_modules/zod/v4/classic/parse.js +0 -15
  416. package/fullstacked_modules/zod/v4/classic/schemas.cjs +0 -1151
  417. package/fullstacked_modules/zod/v4/classic/schemas.d.cts +0 -673
  418. package/fullstacked_modules/zod/v4/classic/schemas.d.ts +0 -673
  419. package/fullstacked_modules/zod/v4/classic/schemas.js +0 -1040
  420. package/fullstacked_modules/zod/v4/core/api.cjs +0 -1060
  421. package/fullstacked_modules/zod/v4/core/api.d.cts +0 -295
  422. package/fullstacked_modules/zod/v4/core/api.d.ts +0 -295
  423. package/fullstacked_modules/zod/v4/core/api.js +0 -925
  424. package/fullstacked_modules/zod/v4/core/checks.cjs +0 -595
  425. package/fullstacked_modules/zod/v4/core/checks.d.cts +0 -278
  426. package/fullstacked_modules/zod/v4/core/checks.d.ts +0 -278
  427. package/fullstacked_modules/zod/v4/core/checks.js +0 -569
  428. package/fullstacked_modules/zod/v4/core/core.cjs +0 -74
  429. package/fullstacked_modules/zod/v4/core/core.d.cts +0 -52
  430. package/fullstacked_modules/zod/v4/core/core.d.ts +0 -52
  431. package/fullstacked_modules/zod/v4/core/core.js +0 -67
  432. package/fullstacked_modules/zod/v4/core/doc.cjs +0 -39
  433. package/fullstacked_modules/zod/v4/core/doc.d.cts +0 -14
  434. package/fullstacked_modules/zod/v4/core/doc.d.ts +0 -14
  435. package/fullstacked_modules/zod/v4/core/doc.js +0 -35
  436. package/fullstacked_modules/zod/v4/core/errors.cjs +0 -213
  437. package/fullstacked_modules/zod/v4/core/errors.d.cts +0 -210
  438. package/fullstacked_modules/zod/v4/core/errors.d.ts +0 -210
  439. package/fullstacked_modules/zod/v4/core/errors.js +0 -182
  440. package/fullstacked_modules/zod/v4/core/index.cjs +0 -43
  441. package/fullstacked_modules/zod/v4/core/index.d.cts +0 -14
  442. package/fullstacked_modules/zod/v4/core/index.d.ts +0 -14
  443. package/fullstacked_modules/zod/v4/core/index.js +0 -14
  444. package/fullstacked_modules/zod/v4/core/json-schema.cjs +0 -2
  445. package/fullstacked_modules/zod/v4/core/json-schema.d.cts +0 -88
  446. package/fullstacked_modules/zod/v4/core/json-schema.d.ts +0 -88
  447. package/fullstacked_modules/zod/v4/core/json-schema.js +0 -1
  448. package/fullstacked_modules/zod/v4/core/package.json +0 -6
  449. package/fullstacked_modules/zod/v4/core/parse.cjs +0 -131
  450. package/fullstacked_modules/zod/v4/core/parse.d.cts +0 -49
  451. package/fullstacked_modules/zod/v4/core/parse.d.ts +0 -49
  452. package/fullstacked_modules/zod/v4/core/parse.js +0 -93
  453. package/fullstacked_modules/zod/v4/core/regexes.cjs +0 -136
  454. package/fullstacked_modules/zod/v4/core/regexes.d.cts +0 -78
  455. package/fullstacked_modules/zod/v4/core/regexes.d.ts +0 -78
  456. package/fullstacked_modules/zod/v4/core/regexes.js +0 -127
  457. package/fullstacked_modules/zod/v4/core/registries.cjs +0 -57
  458. package/fullstacked_modules/zod/v4/core/registries.d.cts +0 -35
  459. package/fullstacked_modules/zod/v4/core/registries.d.ts +0 -35
  460. package/fullstacked_modules/zod/v4/core/registries.js +0 -52
  461. package/fullstacked_modules/zod/v4/core/schemas.cjs +0 -1986
  462. package/fullstacked_modules/zod/v4/core/schemas.d.cts +0 -1113
  463. package/fullstacked_modules/zod/v4/core/schemas.d.ts +0 -1113
  464. package/fullstacked_modules/zod/v4/core/schemas.js +0 -1955
  465. package/fullstacked_modules/zod/v4/core/standard-schema.cjs +0 -2
  466. package/fullstacked_modules/zod/v4/core/standard-schema.d.cts +0 -55
  467. package/fullstacked_modules/zod/v4/core/standard-schema.d.ts +0 -55
  468. package/fullstacked_modules/zod/v4/core/standard-schema.js +0 -1
  469. package/fullstacked_modules/zod/v4/core/to-json-schema.cjs +0 -920
  470. package/fullstacked_modules/zod/v4/core/to-json-schema.d.cts +0 -90
  471. package/fullstacked_modules/zod/v4/core/to-json-schema.d.ts +0 -90
  472. package/fullstacked_modules/zod/v4/core/to-json-schema.js +0 -915
  473. package/fullstacked_modules/zod/v4/core/util.cjs +0 -658
  474. package/fullstacked_modules/zod/v4/core/util.d.cts +0 -197
  475. package/fullstacked_modules/zod/v4/core/util.d.ts +0 -197
  476. package/fullstacked_modules/zod/v4/core/util.js +0 -601
  477. package/fullstacked_modules/zod/v4/core/versions.cjs +0 -8
  478. package/fullstacked_modules/zod/v4/core/versions.d.cts +0 -5
  479. package/fullstacked_modules/zod/v4/core/versions.d.ts +0 -5
  480. package/fullstacked_modules/zod/v4/core/versions.js +0 -5
  481. package/fullstacked_modules/zod/v4/index.cjs +0 -22
  482. package/fullstacked_modules/zod/v4/index.d.cts +0 -3
  483. package/fullstacked_modules/zod/v4/index.d.ts +0 -3
  484. package/fullstacked_modules/zod/v4/index.js +0 -3
  485. package/fullstacked_modules/zod/v4/locales/ar.cjs +0 -143
  486. package/fullstacked_modules/zod/v4/locales/ar.d.cts +0 -5
  487. package/fullstacked_modules/zod/v4/locales/ar.d.ts +0 -4
  488. package/fullstacked_modules/zod/v4/locales/ar.js +0 -116
  489. package/fullstacked_modules/zod/v4/locales/az.cjs +0 -142
  490. package/fullstacked_modules/zod/v4/locales/az.d.cts +0 -5
  491. package/fullstacked_modules/zod/v4/locales/az.d.ts +0 -4
  492. package/fullstacked_modules/zod/v4/locales/az.js +0 -115
  493. package/fullstacked_modules/zod/v4/locales/be.cjs +0 -191
  494. package/fullstacked_modules/zod/v4/locales/be.d.cts +0 -5
  495. package/fullstacked_modules/zod/v4/locales/be.d.ts +0 -4
  496. package/fullstacked_modules/zod/v4/locales/be.js +0 -164
  497. package/fullstacked_modules/zod/v4/locales/bg.cjs +0 -156
  498. package/fullstacked_modules/zod/v4/locales/bg.d.cts +0 -5
  499. package/fullstacked_modules/zod/v4/locales/bg.d.ts +0 -5
  500. package/fullstacked_modules/zod/v4/locales/bg.js +0 -128
  501. package/fullstacked_modules/zod/v4/locales/ca.cjs +0 -145
  502. package/fullstacked_modules/zod/v4/locales/ca.d.cts +0 -5
  503. package/fullstacked_modules/zod/v4/locales/ca.d.ts +0 -4
  504. package/fullstacked_modules/zod/v4/locales/ca.js +0 -118
  505. package/fullstacked_modules/zod/v4/locales/cs.cjs +0 -162
  506. package/fullstacked_modules/zod/v4/locales/cs.d.cts +0 -5
  507. package/fullstacked_modules/zod/v4/locales/cs.d.ts +0 -4
  508. package/fullstacked_modules/zod/v4/locales/cs.js +0 -135
  509. package/fullstacked_modules/zod/v4/locales/da.cjs +0 -158
  510. package/fullstacked_modules/zod/v4/locales/da.d.cts +0 -5
  511. package/fullstacked_modules/zod/v4/locales/da.d.ts +0 -4
  512. package/fullstacked_modules/zod/v4/locales/da.js +0 -131
  513. package/fullstacked_modules/zod/v4/locales/de.cjs +0 -143
  514. package/fullstacked_modules/zod/v4/locales/de.d.cts +0 -5
  515. package/fullstacked_modules/zod/v4/locales/de.d.ts +0 -4
  516. package/fullstacked_modules/zod/v4/locales/de.js +0 -116
  517. package/fullstacked_modules/zod/v4/locales/en.cjs +0 -145
  518. package/fullstacked_modules/zod/v4/locales/en.d.cts +0 -5
  519. package/fullstacked_modules/zod/v4/locales/en.d.ts +0 -5
  520. package/fullstacked_modules/zod/v4/locales/en.js +0 -117
  521. package/fullstacked_modules/zod/v4/locales/eo.cjs +0 -144
  522. package/fullstacked_modules/zod/v4/locales/eo.d.cts +0 -5
  523. package/fullstacked_modules/zod/v4/locales/eo.d.ts +0 -5
  524. package/fullstacked_modules/zod/v4/locales/eo.js +0 -116
  525. package/fullstacked_modules/zod/v4/locales/es.cjs +0 -176
  526. package/fullstacked_modules/zod/v4/locales/es.d.cts +0 -5
  527. package/fullstacked_modules/zod/v4/locales/es.d.ts +0 -4
  528. package/fullstacked_modules/zod/v4/locales/es.js +0 -149
  529. package/fullstacked_modules/zod/v4/locales/fa.cjs +0 -149
  530. package/fullstacked_modules/zod/v4/locales/fa.d.cts +0 -5
  531. package/fullstacked_modules/zod/v4/locales/fa.d.ts +0 -4
  532. package/fullstacked_modules/zod/v4/locales/fa.js +0 -122
  533. package/fullstacked_modules/zod/v4/locales/fi.cjs +0 -149
  534. package/fullstacked_modules/zod/v4/locales/fi.d.cts +0 -5
  535. package/fullstacked_modules/zod/v4/locales/fi.d.ts +0 -4
  536. package/fullstacked_modules/zod/v4/locales/fi.js +0 -122
  537. package/fullstacked_modules/zod/v4/locales/fr-CA.cjs +0 -144
  538. package/fullstacked_modules/zod/v4/locales/fr-CA.d.cts +0 -5
  539. package/fullstacked_modules/zod/v4/locales/fr-CA.d.ts +0 -4
  540. package/fullstacked_modules/zod/v4/locales/fr-CA.js +0 -117
  541. package/fullstacked_modules/zod/v4/locales/fr.cjs +0 -143
  542. package/fullstacked_modules/zod/v4/locales/fr.d.cts +0 -5
  543. package/fullstacked_modules/zod/v4/locales/fr.d.ts +0 -4
  544. package/fullstacked_modules/zod/v4/locales/fr.js +0 -116
  545. package/fullstacked_modules/zod/v4/locales/he.cjs +0 -144
  546. package/fullstacked_modules/zod/v4/locales/he.d.cts +0 -5
  547. package/fullstacked_modules/zod/v4/locales/he.d.ts +0 -4
  548. package/fullstacked_modules/zod/v4/locales/he.js +0 -117
  549. package/fullstacked_modules/zod/v4/locales/hu.cjs +0 -144
  550. package/fullstacked_modules/zod/v4/locales/hu.d.cts +0 -5
  551. package/fullstacked_modules/zod/v4/locales/hu.d.ts +0 -4
  552. package/fullstacked_modules/zod/v4/locales/hu.js +0 -117
  553. package/fullstacked_modules/zod/v4/locales/id.cjs +0 -143
  554. package/fullstacked_modules/zod/v4/locales/id.d.cts +0 -5
  555. package/fullstacked_modules/zod/v4/locales/id.d.ts +0 -4
  556. package/fullstacked_modules/zod/v4/locales/id.js +0 -116
  557. package/fullstacked_modules/zod/v4/locales/index.cjs +0 -100
  558. package/fullstacked_modules/zod/v4/locales/index.d.cts +0 -47
  559. package/fullstacked_modules/zod/v4/locales/index.d.ts +0 -47
  560. package/fullstacked_modules/zod/v4/locales/index.js +0 -47
  561. package/fullstacked_modules/zod/v4/locales/is.cjs +0 -145
  562. package/fullstacked_modules/zod/v4/locales/is.d.cts +0 -5
  563. package/fullstacked_modules/zod/v4/locales/is.d.ts +0 -5
  564. package/fullstacked_modules/zod/v4/locales/is.js +0 -117
  565. package/fullstacked_modules/zod/v4/locales/it.cjs +0 -144
  566. package/fullstacked_modules/zod/v4/locales/it.d.cts +0 -5
  567. package/fullstacked_modules/zod/v4/locales/it.d.ts +0 -4
  568. package/fullstacked_modules/zod/v4/locales/it.js +0 -117
  569. package/fullstacked_modules/zod/v4/locales/ja.cjs +0 -142
  570. package/fullstacked_modules/zod/v4/locales/ja.d.cts +0 -5
  571. package/fullstacked_modules/zod/v4/locales/ja.d.ts +0 -4
  572. package/fullstacked_modules/zod/v4/locales/ja.js +0 -115
  573. package/fullstacked_modules/zod/v4/locales/ka.cjs +0 -153
  574. package/fullstacked_modules/zod/v4/locales/ka.d.cts +0 -5
  575. package/fullstacked_modules/zod/v4/locales/ka.d.ts +0 -5
  576. package/fullstacked_modules/zod/v4/locales/ka.js +0 -125
  577. package/fullstacked_modules/zod/v4/locales/kh.cjs +0 -12
  578. package/fullstacked_modules/zod/v4/locales/kh.d.cts +0 -5
  579. package/fullstacked_modules/zod/v4/locales/kh.d.ts +0 -5
  580. package/fullstacked_modules/zod/v4/locales/kh.js +0 -5
  581. package/fullstacked_modules/zod/v4/locales/km.cjs +0 -144
  582. package/fullstacked_modules/zod/v4/locales/km.d.cts +0 -5
  583. package/fullstacked_modules/zod/v4/locales/km.d.ts +0 -4
  584. package/fullstacked_modules/zod/v4/locales/km.js +0 -117
  585. package/fullstacked_modules/zod/v4/locales/ko.cjs +0 -148
  586. package/fullstacked_modules/zod/v4/locales/ko.d.cts +0 -5
  587. package/fullstacked_modules/zod/v4/locales/ko.d.ts +0 -4
  588. package/fullstacked_modules/zod/v4/locales/ko.js +0 -121
  589. package/fullstacked_modules/zod/v4/locales/lt.cjs +0 -258
  590. package/fullstacked_modules/zod/v4/locales/lt.d.cts +0 -5
  591. package/fullstacked_modules/zod/v4/locales/lt.d.ts +0 -5
  592. package/fullstacked_modules/zod/v4/locales/lt.js +0 -230
  593. package/fullstacked_modules/zod/v4/locales/mk.cjs +0 -145
  594. package/fullstacked_modules/zod/v4/locales/mk.d.cts +0 -5
  595. package/fullstacked_modules/zod/v4/locales/mk.d.ts +0 -4
  596. package/fullstacked_modules/zod/v4/locales/mk.js +0 -118
  597. package/fullstacked_modules/zod/v4/locales/ms.cjs +0 -143
  598. package/fullstacked_modules/zod/v4/locales/ms.d.cts +0 -5
  599. package/fullstacked_modules/zod/v4/locales/ms.d.ts +0 -4
  600. package/fullstacked_modules/zod/v4/locales/ms.js +0 -116
  601. package/fullstacked_modules/zod/v4/locales/nl.cjs +0 -144
  602. package/fullstacked_modules/zod/v4/locales/nl.d.cts +0 -5
  603. package/fullstacked_modules/zod/v4/locales/nl.d.ts +0 -4
  604. package/fullstacked_modules/zod/v4/locales/nl.js +0 -117
  605. package/fullstacked_modules/zod/v4/locales/no.cjs +0 -143
  606. package/fullstacked_modules/zod/v4/locales/no.d.cts +0 -5
  607. package/fullstacked_modules/zod/v4/locales/no.d.ts +0 -4
  608. package/fullstacked_modules/zod/v4/locales/no.js +0 -116
  609. package/fullstacked_modules/zod/v4/locales/ota.cjs +0 -144
  610. package/fullstacked_modules/zod/v4/locales/ota.d.cts +0 -5
  611. package/fullstacked_modules/zod/v4/locales/ota.d.ts +0 -4
  612. package/fullstacked_modules/zod/v4/locales/ota.js +0 -117
  613. package/fullstacked_modules/zod/v4/locales/package.json +0 -6
  614. package/fullstacked_modules/zod/v4/locales/pl.cjs +0 -144
  615. package/fullstacked_modules/zod/v4/locales/pl.d.cts +0 -5
  616. package/fullstacked_modules/zod/v4/locales/pl.d.ts +0 -4
  617. package/fullstacked_modules/zod/v4/locales/pl.js +0 -117
  618. package/fullstacked_modules/zod/v4/locales/ps.cjs +0 -149
  619. package/fullstacked_modules/zod/v4/locales/ps.d.cts +0 -5
  620. package/fullstacked_modules/zod/v4/locales/ps.d.ts +0 -4
  621. package/fullstacked_modules/zod/v4/locales/ps.js +0 -122
  622. package/fullstacked_modules/zod/v4/locales/pt.cjs +0 -143
  623. package/fullstacked_modules/zod/v4/locales/pt.d.cts +0 -5
  624. package/fullstacked_modules/zod/v4/locales/pt.d.ts +0 -4
  625. package/fullstacked_modules/zod/v4/locales/pt.js +0 -116
  626. package/fullstacked_modules/zod/v4/locales/ru.cjs +0 -191
  627. package/fullstacked_modules/zod/v4/locales/ru.d.cts +0 -5
  628. package/fullstacked_modules/zod/v4/locales/ru.d.ts +0 -4
  629. package/fullstacked_modules/zod/v4/locales/ru.js +0 -164
  630. package/fullstacked_modules/zod/v4/locales/sl.cjs +0 -144
  631. package/fullstacked_modules/zod/v4/locales/sl.d.cts +0 -5
  632. package/fullstacked_modules/zod/v4/locales/sl.d.ts +0 -4
  633. package/fullstacked_modules/zod/v4/locales/sl.js +0 -117
  634. package/fullstacked_modules/zod/v4/locales/sv.cjs +0 -145
  635. package/fullstacked_modules/zod/v4/locales/sv.d.cts +0 -5
  636. package/fullstacked_modules/zod/v4/locales/sv.d.ts +0 -4
  637. package/fullstacked_modules/zod/v4/locales/sv.js +0 -118
  638. package/fullstacked_modules/zod/v4/locales/ta.cjs +0 -144
  639. package/fullstacked_modules/zod/v4/locales/ta.d.cts +0 -5
  640. package/fullstacked_modules/zod/v4/locales/ta.d.ts +0 -4
  641. package/fullstacked_modules/zod/v4/locales/ta.js +0 -117
  642. package/fullstacked_modules/zod/v4/locales/th.cjs +0 -144
  643. package/fullstacked_modules/zod/v4/locales/th.d.cts +0 -5
  644. package/fullstacked_modules/zod/v4/locales/th.d.ts +0 -4
  645. package/fullstacked_modules/zod/v4/locales/th.js +0 -117
  646. package/fullstacked_modules/zod/v4/locales/tr.cjs +0 -143
  647. package/fullstacked_modules/zod/v4/locales/tr.d.cts +0 -5
  648. package/fullstacked_modules/zod/v4/locales/tr.d.ts +0 -5
  649. package/fullstacked_modules/zod/v4/locales/tr.js +0 -115
  650. package/fullstacked_modules/zod/v4/locales/ua.cjs +0 -12
  651. package/fullstacked_modules/zod/v4/locales/ua.d.cts +0 -5
  652. package/fullstacked_modules/zod/v4/locales/ua.d.ts +0 -5
  653. package/fullstacked_modules/zod/v4/locales/ua.js +0 -5
  654. package/fullstacked_modules/zod/v4/locales/uk.cjs +0 -144
  655. package/fullstacked_modules/zod/v4/locales/uk.d.cts +0 -5
  656. package/fullstacked_modules/zod/v4/locales/uk.d.ts +0 -4
  657. package/fullstacked_modules/zod/v4/locales/uk.js +0 -117
  658. package/fullstacked_modules/zod/v4/locales/ur.cjs +0 -144
  659. package/fullstacked_modules/zod/v4/locales/ur.d.cts +0 -5
  660. package/fullstacked_modules/zod/v4/locales/ur.d.ts +0 -4
  661. package/fullstacked_modules/zod/v4/locales/ur.js +0 -117
  662. package/fullstacked_modules/zod/v4/locales/vi.cjs +0 -143
  663. package/fullstacked_modules/zod/v4/locales/vi.d.cts +0 -5
  664. package/fullstacked_modules/zod/v4/locales/vi.d.ts +0 -4
  665. package/fullstacked_modules/zod/v4/locales/vi.js +0 -116
  666. package/fullstacked_modules/zod/v4/locales/yo.cjs +0 -142
  667. package/fullstacked_modules/zod/v4/locales/yo.d.cts +0 -5
  668. package/fullstacked_modules/zod/v4/locales/yo.d.ts +0 -4
  669. package/fullstacked_modules/zod/v4/locales/yo.js +0 -115
  670. package/fullstacked_modules/zod/v4/locales/zh-CN.cjs +0 -143
  671. package/fullstacked_modules/zod/v4/locales/zh-CN.d.cts +0 -5
  672. package/fullstacked_modules/zod/v4/locales/zh-CN.d.ts +0 -4
  673. package/fullstacked_modules/zod/v4/locales/zh-CN.js +0 -116
  674. package/fullstacked_modules/zod/v4/locales/zh-TW.cjs +0 -144
  675. package/fullstacked_modules/zod/v4/locales/zh-TW.d.cts +0 -5
  676. package/fullstacked_modules/zod/v4/locales/zh-TW.d.ts +0 -4
  677. package/fullstacked_modules/zod/v4/locales/zh-TW.js +0 -117
  678. package/fullstacked_modules/zod/v4/mini/checks.cjs +0 -34
  679. package/fullstacked_modules/zod/v4/mini/checks.d.cts +0 -1
  680. package/fullstacked_modules/zod/v4/mini/checks.d.ts +0 -1
  681. package/fullstacked_modules/zod/v4/mini/checks.js +0 -1
  682. package/fullstacked_modules/zod/v4/mini/coerce.cjs +0 -47
  683. package/fullstacked_modules/zod/v4/mini/coerce.d.cts +0 -7
  684. package/fullstacked_modules/zod/v4/mini/coerce.d.ts +0 -7
  685. package/fullstacked_modules/zod/v4/mini/coerce.js +0 -17
  686. package/fullstacked_modules/zod/v4/mini/external.cjs +0 -62
  687. package/fullstacked_modules/zod/v4/mini/external.d.cts +0 -11
  688. package/fullstacked_modules/zod/v4/mini/external.d.ts +0 -11
  689. package/fullstacked_modules/zod/v4/mini/external.js +0 -13
  690. package/fullstacked_modules/zod/v4/mini/index.cjs +0 -32
  691. package/fullstacked_modules/zod/v4/mini/index.d.cts +0 -3
  692. package/fullstacked_modules/zod/v4/mini/index.d.ts +0 -3
  693. package/fullstacked_modules/zod/v4/mini/index.js +0 -3
  694. package/fullstacked_modules/zod/v4/mini/iso.cjs +0 -60
  695. package/fullstacked_modules/zod/v4/mini/iso.d.cts +0 -22
  696. package/fullstacked_modules/zod/v4/mini/iso.d.ts +0 -22
  697. package/fullstacked_modules/zod/v4/mini/iso.js +0 -30
  698. package/fullstacked_modules/zod/v4/mini/package.json +0 -6
  699. package/fullstacked_modules/zod/v4/mini/parse.cjs +0 -16
  700. package/fullstacked_modules/zod/v4/mini/parse.d.cts +0 -1
  701. package/fullstacked_modules/zod/v4/mini/parse.d.ts +0 -1
  702. package/fullstacked_modules/zod/v4/mini/parse.js +0 -1
  703. package/fullstacked_modules/zod/v4/mini/schemas.cjs +0 -892
  704. package/fullstacked_modules/zod/v4/mini/schemas.d.cts +0 -407
  705. package/fullstacked_modules/zod/v4/mini/schemas.d.ts +0 -407
  706. package/fullstacked_modules/zod/v4/mini/schemas.js +0 -775
  707. package/fullstacked_modules/zod/v4/package.json +0 -6
  708. package/fullstacked_modules/zod/v4-mini/index.cjs +0 -17
  709. package/fullstacked_modules/zod/v4-mini/index.d.cts +0 -1
  710. package/fullstacked_modules/zod/v4-mini/index.d.ts +0 -1
  711. package/fullstacked_modules/zod/v4-mini/index.js +0 -1
  712. package/fullstacked_modules/zod/v4-mini/package.json +0 -6
  713. /package/fullstacked_modules/{platform/index.ts → platform.ts} +0 -0
@@ -1,2622 +0,0 @@
1
- import { Validator } from "@seriousme/openapi-schema-validator";
2
- import { describe, expect, test } from "vitest";
3
- import * as z from "zod/v4";
4
- // import * as zCore from "zod/v4/core";
5
-
6
- const openAPI30Validator = new Validator();
7
- /** @see https://github.com/colinhacks/zod/issues/5147 */
8
- const validateOpenAPI30Schema = async (zodJSONSchema: Record<string, unknown>): Promise<true> => {
9
- const res = await openAPI30Validator.validate({
10
- openapi: "3.0.0",
11
- info: {
12
- title: "SampleApi",
13
- description: "Sample backend service",
14
- version: "1.0.0",
15
- },
16
- components: { schemas: { test: zodJSONSchema } },
17
- paths: {},
18
- });
19
-
20
- if (!res.valid) {
21
- // `console.error` should make `vitest` trow an unhandled error
22
- // printing the validation messages in consoles
23
- console.error(
24
- `OpenAPI schema is not valid against ${openAPI30Validator.version}`,
25
- JSON.stringify(res.errors, null, 2)
26
- );
27
- }
28
-
29
- return true;
30
- };
31
-
32
- describe("toJSONSchema", () => {
33
- test("primitive types", () => {
34
- expect(z.toJSONSchema(z.string())).toMatchInlineSnapshot(`
35
- {
36
- "$schema": "https://json-schema.org/draft/2020-12/schema",
37
- "type": "string",
38
- }
39
- `);
40
- expect(z.toJSONSchema(z.number())).toMatchInlineSnapshot(`
41
- {
42
- "$schema": "https://json-schema.org/draft/2020-12/schema",
43
- "type": "number",
44
- }
45
- `);
46
- expect(z.toJSONSchema(z.boolean())).toMatchInlineSnapshot(`
47
- {
48
- "$schema": "https://json-schema.org/draft/2020-12/schema",
49
- "type": "boolean",
50
- }
51
- `);
52
- expect(z.toJSONSchema(z.null())).toMatchInlineSnapshot(`
53
- {
54
- "$schema": "https://json-schema.org/draft/2020-12/schema",
55
- "type": "null",
56
- }
57
- `);
58
- expect(z.toJSONSchema(z.undefined(), { unrepresentable: "any" })).toMatchInlineSnapshot(`
59
- {
60
- "$schema": "https://json-schema.org/draft/2020-12/schema",
61
- }
62
- `);
63
- expect(z.toJSONSchema(z.any())).toMatchInlineSnapshot(`
64
- {
65
- "$schema": "https://json-schema.org/draft/2020-12/schema",
66
- }
67
- `);
68
- expect(z.toJSONSchema(z.unknown())).toMatchInlineSnapshot(`
69
- {
70
- "$schema": "https://json-schema.org/draft/2020-12/schema",
71
- }
72
- `);
73
- expect(z.toJSONSchema(z.never())).toMatchInlineSnapshot(`
74
- {
75
- "$schema": "https://json-schema.org/draft/2020-12/schema",
76
- "not": {},
77
- }
78
- `);
79
- expect(z.toJSONSchema(z.email())).toMatchInlineSnapshot(`
80
- {
81
- "$schema": "https://json-schema.org/draft/2020-12/schema",
82
- "format": "email",
83
- "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
84
- "type": "string",
85
- }
86
- `);
87
- expect(z.toJSONSchema(z.iso.datetime())).toMatchInlineSnapshot(`
88
- {
89
- "$schema": "https://json-schema.org/draft/2020-12/schema",
90
- "format": "date-time",
91
- "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
92
- "type": "string",
93
- }
94
- `);
95
- expect(z.toJSONSchema(z.iso.date())).toMatchInlineSnapshot(`
96
- {
97
- "$schema": "https://json-schema.org/draft/2020-12/schema",
98
- "format": "date",
99
- "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
100
- "type": "string",
101
- }
102
- `);
103
- expect(z.toJSONSchema(z.iso.time())).toMatchInlineSnapshot(`
104
- {
105
- "$schema": "https://json-schema.org/draft/2020-12/schema",
106
- "format": "time",
107
- "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?$",
108
- "type": "string",
109
- }
110
- `);
111
- expect(z.toJSONSchema(z.iso.duration())).toMatchInlineSnapshot(`
112
- {
113
- "$schema": "https://json-schema.org/draft/2020-12/schema",
114
- "format": "duration",
115
- "pattern": "^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$",
116
- "type": "string",
117
- }
118
- `);
119
- expect(z.toJSONSchema(z.ipv4())).toMatchInlineSnapshot(`
120
- {
121
- "$schema": "https://json-schema.org/draft/2020-12/schema",
122
- "format": "ipv4",
123
- "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$",
124
- "type": "string",
125
- }
126
- `);
127
- expect(z.toJSONSchema(z.ipv6())).toMatchInlineSnapshot(`
128
- {
129
- "$schema": "https://json-schema.org/draft/2020-12/schema",
130
- "format": "ipv6",
131
- "pattern": "^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$",
132
- "type": "string",
133
- }
134
- `);
135
- expect(z.toJSONSchema(z.uuid())).toMatchInlineSnapshot(`
136
- {
137
- "$schema": "https://json-schema.org/draft/2020-12/schema",
138
- "format": "uuid",
139
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
140
- "type": "string",
141
- }
142
- `);
143
- expect(z.toJSONSchema(z.guid())).toMatchInlineSnapshot(`
144
- {
145
- "$schema": "https://json-schema.org/draft/2020-12/schema",
146
- "format": "uuid",
147
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$",
148
- "type": "string",
149
- }
150
- `);
151
- expect(z.toJSONSchema(z.url())).toMatchInlineSnapshot(`
152
- {
153
- "$schema": "https://json-schema.org/draft/2020-12/schema",
154
- "format": "uri",
155
- "type": "string",
156
- }
157
- `);
158
- expect(z.toJSONSchema(z.base64())).toMatchInlineSnapshot(`
159
- {
160
- "$schema": "https://json-schema.org/draft/2020-12/schema",
161
- "contentEncoding": "base64",
162
- "format": "base64",
163
- "pattern": "^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$",
164
- "type": "string",
165
- }
166
- `);
167
- expect(z.toJSONSchema(z.cuid())).toMatchInlineSnapshot(`
168
- {
169
- "$schema": "https://json-schema.org/draft/2020-12/schema",
170
- "format": "cuid",
171
- "pattern": "^[cC][^\\s-]{8,}$",
172
- "type": "string",
173
- }
174
- `);
175
- // expect(z.toJSONSchema(z.regex(/asdf/))).toMatchInlineSnapshot();
176
- expect(z.toJSONSchema(z.emoji())).toMatchInlineSnapshot(`
177
- {
178
- "$schema": "https://json-schema.org/draft/2020-12/schema",
179
- "format": "emoji",
180
- "pattern": "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",
181
- "type": "string",
182
- }
183
- `);
184
- expect(z.toJSONSchema(z.nanoid())).toMatchInlineSnapshot(`
185
- {
186
- "$schema": "https://json-schema.org/draft/2020-12/schema",
187
- "format": "nanoid",
188
- "pattern": "^[a-zA-Z0-9_-]{21}$",
189
- "type": "string",
190
- }
191
- `);
192
- expect(z.toJSONSchema(z.cuid2())).toMatchInlineSnapshot(`
193
- {
194
- "$schema": "https://json-schema.org/draft/2020-12/schema",
195
- "format": "cuid2",
196
- "pattern": "^[0-9a-z]+$",
197
- "type": "string",
198
- }
199
- `);
200
- expect(z.toJSONSchema(z.ulid())).toMatchInlineSnapshot(`
201
- {
202
- "$schema": "https://json-schema.org/draft/2020-12/schema",
203
- "format": "ulid",
204
- "pattern": "^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$",
205
- "type": "string",
206
- }
207
- `);
208
- // expect(z.toJSONSchema(z.cidr())).toMatchInlineSnapshot();
209
- expect(z.toJSONSchema(z.number())).toMatchInlineSnapshot(`
210
- {
211
- "$schema": "https://json-schema.org/draft/2020-12/schema",
212
- "type": "number",
213
- }
214
- `);
215
- expect(z.toJSONSchema(z.int())).toMatchInlineSnapshot(`
216
- {
217
- "$schema": "https://json-schema.org/draft/2020-12/schema",
218
- "maximum": 9007199254740991,
219
- "minimum": -9007199254740991,
220
- "type": "integer",
221
- }
222
- `);
223
- expect(z.toJSONSchema(z.int32())).toMatchInlineSnapshot(`
224
- {
225
- "$schema": "https://json-schema.org/draft/2020-12/schema",
226
- "maximum": 2147483647,
227
- "minimum": -2147483648,
228
- "type": "integer",
229
- }
230
- `);
231
- expect(z.toJSONSchema(z.float32())).toMatchInlineSnapshot(`
232
- {
233
- "$schema": "https://json-schema.org/draft/2020-12/schema",
234
- "maximum": 3.4028234663852886e+38,
235
- "minimum": -3.4028234663852886e+38,
236
- "type": "number",
237
- }
238
- `);
239
- expect(z.toJSONSchema(z.float64())).toMatchInlineSnapshot(`
240
- {
241
- "$schema": "https://json-schema.org/draft/2020-12/schema",
242
- "maximum": 1.7976931348623157e+308,
243
- "minimum": -1.7976931348623157e+308,
244
- "type": "number",
245
- }
246
- `);
247
- expect(z.toJSONSchema(z.jwt())).toMatchInlineSnapshot(`
248
- {
249
- "$schema": "https://json-schema.org/draft/2020-12/schema",
250
- "format": "jwt",
251
- "type": "string",
252
- }
253
- `);
254
- });
255
-
256
- test("unsupported schema types", () => {
257
- expect(() => z.toJSONSchema(z.bigint())).toThrow("BigInt cannot be represented in JSON Schema");
258
- expect(() => z.toJSONSchema(z.int64())).toThrow("BigInt cannot be represented in JSON Schema");
259
- expect(() => z.toJSONSchema(z.symbol())).toThrow("Symbols cannot be represented in JSON Schema");
260
- expect(() => z.toJSONSchema(z.void())).toThrow("Void cannot be represented in JSON Schema");
261
- expect(() => z.toJSONSchema(z.undefined())).toThrow("Undefined cannot be represented in JSON Schema");
262
- expect(() => z.toJSONSchema(z.date())).toThrow("Date cannot be represented in JSON Schema");
263
- expect(() => z.toJSONSchema(z.map(z.string(), z.number()))).toThrow("Map cannot be represented in JSON Schema");
264
- expect(() => z.toJSONSchema(z.set(z.string()))).toThrow("Set cannot be represented in JSON Schema");
265
- expect(() => z.toJSONSchema(z.custom(() => true))).toThrow("Custom types cannot be represented in JSON Schema");
266
-
267
- // Transform
268
- const transformSchema = z.string().transform((val) => Number.parseInt(val));
269
- expect(() => z.toJSONSchema(transformSchema)).toThrow("Transforms cannot be represented in JSON Schema");
270
-
271
- // Static catch values
272
- const staticCatchSchema = z.string().catch(() => "sup");
273
- expect(z.toJSONSchema(staticCatchSchema)).toMatchInlineSnapshot(`
274
- {
275
- "$schema": "https://json-schema.org/draft/2020-12/schema",
276
- "default": "sup",
277
- "type": "string",
278
- }
279
- `);
280
-
281
- // Dynamic catch values
282
- const dynamicCatchSchema = z.string().catch((ctx) => `${ctx.issues.length}`);
283
- expect(() => z.toJSONSchema(dynamicCatchSchema)).toThrow("Dynamic catch values are not supported in JSON Schema");
284
- });
285
-
286
- test("string formats", () => {
287
- expect(z.toJSONSchema(z.string().email())).toMatchInlineSnapshot(`
288
- {
289
- "$schema": "https://json-schema.org/draft/2020-12/schema",
290
- "format": "email",
291
- "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
292
- "type": "string",
293
- }
294
- `);
295
- expect(z.toJSONSchema(z.string().uuid())).toMatchInlineSnapshot(`
296
- {
297
- "$schema": "https://json-schema.org/draft/2020-12/schema",
298
- "format": "uuid",
299
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
300
- "type": "string",
301
- }
302
- `);
303
- expect(z.toJSONSchema(z.iso.datetime())).toMatchInlineSnapshot(`
304
- {
305
- "$schema": "https://json-schema.org/draft/2020-12/schema",
306
- "format": "date-time",
307
- "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
308
- "type": "string",
309
- }
310
- `);
311
-
312
- expect(z.toJSONSchema(z.iso.date())).toMatchInlineSnapshot(`
313
- {
314
- "$schema": "https://json-schema.org/draft/2020-12/schema",
315
- "format": "date",
316
- "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
317
- "type": "string",
318
- }
319
- `);
320
- expect(z.toJSONSchema(z.iso.time())).toMatchInlineSnapshot(`
321
- {
322
- "$schema": "https://json-schema.org/draft/2020-12/schema",
323
- "format": "time",
324
- "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?$",
325
- "type": "string",
326
- }
327
- `);
328
- expect(z.toJSONSchema(z.iso.duration())).toMatchInlineSnapshot(`
329
- {
330
- "$schema": "https://json-schema.org/draft/2020-12/schema",
331
- "format": "duration",
332
- "pattern": "^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$",
333
- "type": "string",
334
- }
335
- `);
336
- // expect(z.toJSONSchema(z.string().ip())).toMatchInlineSnapshot(`
337
- // {
338
- // "pattern": /\\(\\^\\(\\?:\\(\\?:25\\[0-5\\]\\|2\\[0-4\\]\\[0-9\\]\\|1\\[0-9\\]\\[0-9\\]\\|\\[1-9\\]\\[0-9\\]\\|\\[0-9\\]\\)\\\\\\.\\)\\{3\\}\\(\\?:25\\[0-5\\]\\|2\\[0-4\\]\\[0-9\\]\\|1\\[0-9\\]\\[0-9\\]\\|\\[1-9\\]\\[0-9\\]\\|\\[0-9\\]\\)\\$\\)\\|\\(\\^\\(\\(\\[a-fA-F0-9\\]\\{1,4\\}:\\)\\{7\\}\\|::\\(\\[a-fA-F0-9\\]\\{1,4\\}:\\)\\{0,6\\}\\|\\(\\[a-fA-F0-9\\]\\{1,4\\}:\\)\\{1\\}:\\(\\[a-fA-F0-9\\]\\{1,4\\}:\\)\\{0,5\\}\\|\\(\\[a-fA-F0-9\\]\\{1,4\\}:\\)\\{2\\}:\\(\\[a-fA-F0-9\\]\\{1,4\\}:\\)\\{0,4\\}\\|\\(\\[a-fA-F0-9\\]\\{1,4\\}:\\)\\{3\\}:\\(\\[a-fA-F0-9\\]\\{1,4\\}:\\)\\{0,3\\}\\|\\(\\[a-fA-F0-9\\]\\{1,4\\}:\\)\\{4\\}:\\(\\[a-fA-F0-9\\]\\{1,4\\}:\\)\\{0,2\\}\\|\\(\\[a-fA-F0-9\\]\\{1,4\\}:\\)\\{5\\}:\\(\\[a-fA-F0-9\\]\\{1,4\\}:\\)\\{0,1\\}\\)\\(\\[a-fA-F0-9\\]\\{1,4\\}\\|\\(\\(\\(25\\[0-5\\]\\)\\|\\(2\\[0-4\\]\\[0-9\\]\\)\\|\\(1\\[0-9\\]\\{2\\}\\)\\|\\(\\[0-9\\]\\{1,2\\}\\)\\)\\\\\\.\\)\\{3\\}\\(\\(25\\[0-5\\]\\)\\|\\(2\\[0-4\\]\\[0-9\\]\\)\\|\\(1\\[0-9\\]\\{2\\}\\)\\|\\(\\[0-9\\]\\{1,2\\}\\)\\)\\)\\$\\)/,
339
- // "type": "string",
340
- // }
341
- // `);
342
- expect(z.toJSONSchema(z.ipv4())).toMatchInlineSnapshot(`
343
- {
344
- "$schema": "https://json-schema.org/draft/2020-12/schema",
345
- "format": "ipv4",
346
- "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$",
347
- "type": "string",
348
- }
349
- `);
350
-
351
- expect(z.toJSONSchema(z.ipv6())).toMatchInlineSnapshot(`
352
- {
353
- "$schema": "https://json-schema.org/draft/2020-12/schema",
354
- "format": "ipv6",
355
- "pattern": "^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$",
356
- "type": "string",
357
- }
358
- `);
359
-
360
- expect(z.toJSONSchema(z.base64())).toMatchInlineSnapshot(`
361
- {
362
- "$schema": "https://json-schema.org/draft/2020-12/schema",
363
- "contentEncoding": "base64",
364
- "format": "base64",
365
- "pattern": "^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$",
366
- "type": "string",
367
- }
368
- `);
369
- expect(z.toJSONSchema(z.url())).toMatchInlineSnapshot(`
370
- {
371
- "$schema": "https://json-schema.org/draft/2020-12/schema",
372
- "format": "uri",
373
- "type": "string",
374
- }
375
- `);
376
- expect(z.toJSONSchema(z.guid())).toMatchInlineSnapshot(`
377
- {
378
- "$schema": "https://json-schema.org/draft/2020-12/schema",
379
- "format": "uuid",
380
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$",
381
- "type": "string",
382
- }
383
- `);
384
- expect(z.toJSONSchema(z.string().regex(/asdf/))).toMatchInlineSnapshot(`
385
- {
386
- "$schema": "https://json-schema.org/draft/2020-12/schema",
387
- "pattern": "asdf",
388
- "type": "string",
389
- }
390
- `);
391
- });
392
-
393
- test("string patterns", () => {
394
- expect(
395
- z.toJSONSchema(
396
- z
397
- .string()
398
- .startsWith("hello")
399
- .includes("cruel")
400
- .includes("dark", { position: 10 })
401
- .endsWith("world")
402
- .regex(/stuff/)
403
- )
404
- ).toMatchInlineSnapshot(`
405
- {
406
- "$schema": "https://json-schema.org/draft/2020-12/schema",
407
- "allOf": [
408
- {
409
- "pattern": "^hello.*",
410
- },
411
- {
412
- "pattern": "cruel",
413
- },
414
- {
415
- "pattern": "^.{10}dark",
416
- },
417
- {
418
- "pattern": ".*world$",
419
- },
420
- {
421
- "pattern": "stuff",
422
- },
423
- ],
424
- "type": "string",
425
- }
426
- `);
427
-
428
- expect(
429
- z.toJSONSchema(
430
- z
431
- .string()
432
- .startsWith("hello")
433
- .includes("cruel")
434
- .includes("dark", { position: 10 })
435
- .endsWith("world")
436
- .regex(/stuff/),
437
- {
438
- target: "draft-7",
439
- }
440
- )
441
- ).toMatchInlineSnapshot(`
442
- {
443
- "$schema": "http://json-schema.org/draft-07/schema#",
444
- "allOf": [
445
- {
446
- "pattern": "^hello.*",
447
- "type": "string",
448
- },
449
- {
450
- "pattern": "cruel",
451
- "type": "string",
452
- },
453
- {
454
- "pattern": "^.{10}dark",
455
- "type": "string",
456
- },
457
- {
458
- "pattern": ".*world$",
459
- "type": "string",
460
- },
461
- {
462
- "pattern": "stuff",
463
- "type": "string",
464
- },
465
- ],
466
- "type": "string",
467
- }
468
- `);
469
- });
470
-
471
- test("number constraints", () => {
472
- expect(z.toJSONSchema(z.number().min(5).max(10))).toMatchInlineSnapshot(
473
- `
474
- {
475
- "$schema": "https://json-schema.org/draft/2020-12/schema",
476
- "maximum": 10,
477
- "minimum": 5,
478
- "type": "number",
479
- }
480
- `
481
- );
482
-
483
- expect(z.toJSONSchema(z.number().gt(5).gt(10))).toMatchInlineSnapshot(`
484
- {
485
- "$schema": "https://json-schema.org/draft/2020-12/schema",
486
- "exclusiveMinimum": 10,
487
- "type": "number",
488
- }
489
- `);
490
-
491
- expect(z.toJSONSchema(z.number().gt(5).gte(10))).toMatchInlineSnapshot(`
492
- {
493
- "$schema": "https://json-schema.org/draft/2020-12/schema",
494
- "minimum": 10,
495
- "type": "number",
496
- }
497
- `);
498
-
499
- expect(z.toJSONSchema(z.number().lt(5).lt(3))).toMatchInlineSnapshot(`
500
- {
501
- "$schema": "https://json-schema.org/draft/2020-12/schema",
502
- "exclusiveMaximum": 3,
503
- "type": "number",
504
- }
505
- `);
506
-
507
- expect(z.toJSONSchema(z.number().lt(5).lt(3).lte(2))).toMatchInlineSnapshot(`
508
- {
509
- "$schema": "https://json-schema.org/draft/2020-12/schema",
510
- "maximum": 2,
511
- "type": "number",
512
- }
513
- `);
514
-
515
- expect(z.toJSONSchema(z.number().lt(5).lte(3))).toMatchInlineSnapshot(`
516
- {
517
- "$schema": "https://json-schema.org/draft/2020-12/schema",
518
- "maximum": 3,
519
- "type": "number",
520
- }
521
- `);
522
-
523
- expect(z.toJSONSchema(z.number().gt(5).lt(10))).toMatchInlineSnapshot(`
524
- {
525
- "$schema": "https://json-schema.org/draft/2020-12/schema",
526
- "exclusiveMaximum": 10,
527
- "exclusiveMinimum": 5,
528
- "type": "number",
529
- }
530
- `);
531
- expect(z.toJSONSchema(z.number().gte(5).lte(10))).toMatchInlineSnapshot(`
532
- {
533
- "$schema": "https://json-schema.org/draft/2020-12/schema",
534
- "maximum": 10,
535
- "minimum": 5,
536
- "type": "number",
537
- }
538
- `);
539
- expect(z.toJSONSchema(z.number().positive())).toMatchInlineSnapshot(`
540
- {
541
- "$schema": "https://json-schema.org/draft/2020-12/schema",
542
- "exclusiveMinimum": 0,
543
- "type": "number",
544
- }
545
- `);
546
- expect(z.toJSONSchema(z.number().negative())).toMatchInlineSnapshot(`
547
- {
548
- "$schema": "https://json-schema.org/draft/2020-12/schema",
549
- "exclusiveMaximum": 0,
550
- "type": "number",
551
- }
552
- `);
553
- expect(z.toJSONSchema(z.number().nonpositive())).toMatchInlineSnapshot(`
554
- {
555
- "$schema": "https://json-schema.org/draft/2020-12/schema",
556
- "maximum": 0,
557
- "type": "number",
558
- }
559
- `);
560
- expect(z.toJSONSchema(z.number().nonnegative())).toMatchInlineSnapshot(`
561
- {
562
- "$schema": "https://json-schema.org/draft/2020-12/schema",
563
- "minimum": 0,
564
- "type": "number",
565
- }
566
- `);
567
- });
568
-
569
- test("number constraints draft-4", () => {
570
- expect(z.toJSONSchema(z.number().gt(5).lt(10), { target: "draft-4" })).toMatchInlineSnapshot(`
571
- {
572
- "$schema": "http://json-schema.org/draft-04/schema#",
573
- "exclusiveMaximum": true,
574
- "exclusiveMinimum": true,
575
- "maximum": 10,
576
- "minimum": 5,
577
- "type": "number",
578
- }
579
- `);
580
- });
581
-
582
- test("nullable openapi-3.0", () => {
583
- const schema = z.string().nullable();
584
- const jsonSchema = z.toJSONSchema(schema, { target: "openapi-3.0" });
585
- validateOpenAPI30Schema(jsonSchema);
586
- expect(jsonSchema).toMatchInlineSnapshot(`
587
- {
588
- "nullable": true,
589
- "type": "string",
590
- }
591
- `);
592
- });
593
-
594
- test("union with null openapi-3.0", () => {
595
- const schema = z.union([z.string(), z.null()]);
596
- const jsonSchema = z.toJSONSchema(schema, { target: "openapi-3.0" });
597
- validateOpenAPI30Schema(jsonSchema);
598
- expect(jsonSchema).toMatchInlineSnapshot(`
599
- {
600
- "anyOf": [
601
- {
602
- "type": "string",
603
- },
604
- {
605
- "enum": [
606
- null,
607
- ],
608
- "nullable": true,
609
- "type": "string",
610
- },
611
- ],
612
- }
613
- `);
614
- });
615
-
616
- test("number with exclusive min-max openapi-3.0", () => {
617
- const schema = z.number().lt(100).gt(1);
618
- const jsonSchema = z.toJSONSchema(schema, { target: "openapi-3.0" });
619
- validateOpenAPI30Schema(jsonSchema);
620
- expect(jsonSchema).toMatchInlineSnapshot(`
621
- {
622
- "exclusiveMaximum": true,
623
- "exclusiveMinimum": true,
624
- "maximum": 100,
625
- "minimum": 1,
626
- "type": "number",
627
- }
628
- `);
629
- });
630
-
631
- test("arrays", () => {
632
- expect(z.toJSONSchema(z.array(z.string()))).toMatchInlineSnapshot(`
633
- {
634
- "$schema": "https://json-schema.org/draft/2020-12/schema",
635
- "items": {
636
- "type": "string",
637
- },
638
- "type": "array",
639
- }
640
- `);
641
- });
642
-
643
- test("unions", () => {
644
- const schema = z.union([z.string(), z.number()]);
645
- expect(z.toJSONSchema(schema)).toMatchInlineSnapshot(`
646
- {
647
- "$schema": "https://json-schema.org/draft/2020-12/schema",
648
- "anyOf": [
649
- {
650
- "type": "string",
651
- },
652
- {
653
- "type": "number",
654
- },
655
- ],
656
- }
657
- `);
658
- });
659
-
660
- test("intersections", () => {
661
- const schema = z.intersection(z.object({ name: z.string() }), z.object({ age: z.number() }));
662
-
663
- expect(z.toJSONSchema(schema)).toMatchInlineSnapshot(`
664
- {
665
- "$schema": "https://json-schema.org/draft/2020-12/schema",
666
- "allOf": [
667
- {
668
- "additionalProperties": false,
669
- "properties": {
670
- "name": {
671
- "type": "string",
672
- },
673
- },
674
- "required": [
675
- "name",
676
- ],
677
- "type": "object",
678
- },
679
- {
680
- "additionalProperties": false,
681
- "properties": {
682
- "age": {
683
- "type": "number",
684
- },
685
- },
686
- "required": [
687
- "age",
688
- ],
689
- "type": "object",
690
- },
691
- ],
692
- }
693
- `);
694
- });
695
-
696
- test("record", () => {
697
- const schema = z.record(z.string(), z.boolean());
698
- expect(z.toJSONSchema(schema)).toMatchInlineSnapshot(`
699
- {
700
- "$schema": "https://json-schema.org/draft/2020-12/schema",
701
- "additionalProperties": {
702
- "type": "boolean",
703
- },
704
- "propertyNames": {
705
- "type": "string",
706
- },
707
- "type": "object",
708
- }
709
- `);
710
- });
711
-
712
- test("record openapi-3.0", () => {
713
- const schema = z.record(z.string(), z.boolean());
714
- const jsonSchema = z.toJSONSchema(schema, { target: "openapi-3.0" });
715
- validateOpenAPI30Schema(jsonSchema);
716
- expect(jsonSchema).toMatchInlineSnapshot(`
717
- {
718
- "additionalProperties": {
719
- "type": "boolean",
720
- },
721
- "type": "object",
722
- }
723
- `);
724
- });
725
-
726
- test("tuple", () => {
727
- const schema = z.tuple([z.string(), z.number()]);
728
- expect(z.toJSONSchema(schema)).toMatchInlineSnapshot(`
729
- {
730
- "$schema": "https://json-schema.org/draft/2020-12/schema",
731
- "prefixItems": [
732
- {
733
- "type": "string",
734
- },
735
- {
736
- "type": "number",
737
- },
738
- ],
739
- "type": "array",
740
- }
741
- `);
742
- });
743
-
744
- test("tuple with rest", () => {
745
- const schema = z.tuple([z.string(), z.number()]).rest(z.boolean());
746
- expect(z.toJSONSchema(schema)).toMatchInlineSnapshot(`
747
- {
748
- "$schema": "https://json-schema.org/draft/2020-12/schema",
749
- "items": {
750
- "type": "boolean",
751
- },
752
- "prefixItems": [
753
- {
754
- "type": "string",
755
- },
756
- {
757
- "type": "number",
758
- },
759
- ],
760
- "type": "array",
761
- }
762
- `);
763
- });
764
-
765
- test("tuple openapi-3.0", () => {
766
- const schema = z.tuple([z.string(), z.number()]);
767
- const jsonSchema = z.toJSONSchema(schema, { target: "openapi-3.0" });
768
- validateOpenAPI30Schema(jsonSchema);
769
- expect(jsonSchema).toMatchInlineSnapshot(`
770
- {
771
- "items": {
772
- "anyOf": [
773
- {
774
- "type": "string",
775
- },
776
- {
777
- "type": "number",
778
- },
779
- ],
780
- },
781
- "maxItems": 2,
782
- "minItems": 2,
783
- "type": "array",
784
- }
785
- `);
786
- });
787
-
788
- test("tuple with rest openapi-3.0", () => {
789
- const schema = z.tuple([z.string(), z.number()]).rest(z.boolean());
790
- const jsonSchema = z.toJSONSchema(schema, { target: "openapi-3.0" });
791
- validateOpenAPI30Schema(jsonSchema);
792
- expect(jsonSchema).toMatchInlineSnapshot(`
793
- {
794
- "items": {
795
- "anyOf": [
796
- {
797
- "type": "string",
798
- },
799
- {
800
- "type": "number",
801
- },
802
- {
803
- "type": "boolean",
804
- },
805
- ],
806
- },
807
- "minItems": 3,
808
- "type": "array",
809
- }
810
- `);
811
- });
812
-
813
- test("tuple with null openapi-3.0", () => {
814
- const schema = z.tuple([z.string(), z.number(), z.null()]);
815
- const jsonSchema = z.toJSONSchema(schema, { target: "openapi-3.0" });
816
- validateOpenAPI30Schema(jsonSchema);
817
- expect(jsonSchema).toMatchInlineSnapshot(`
818
- {
819
- "items": {
820
- "anyOf": [
821
- {
822
- "type": "string",
823
- },
824
- {
825
- "type": "number",
826
- },
827
- {
828
- "enum": [
829
- null,
830
- ],
831
- "nullable": true,
832
- "type": "string",
833
- },
834
- ],
835
- },
836
- "maxItems": 3,
837
- "minItems": 3,
838
- "type": "array",
839
- }
840
- `);
841
- });
842
-
843
- test("tuple draft-7", () => {
844
- const schema = z.tuple([z.string(), z.number()]);
845
- expect(z.toJSONSchema(schema, { target: "draft-7", io: "input" })).toMatchInlineSnapshot(`
846
- {
847
- "$schema": "http://json-schema.org/draft-07/schema#",
848
- "items": [
849
- {
850
- "type": "string",
851
- },
852
- {
853
- "type": "number",
854
- },
855
- ],
856
- "type": "array",
857
- }
858
- `);
859
- });
860
-
861
- test("tuple with rest draft-7", () => {
862
- const schema = z.tuple([z.string(), z.number()]).rest(z.boolean());
863
- expect(z.toJSONSchema(schema, { target: "draft-7", io: "input" })).toMatchInlineSnapshot(`
864
- {
865
- "$schema": "http://json-schema.org/draft-07/schema#",
866
- "additionalItems": {
867
- "type": "boolean",
868
- },
869
- "items": [
870
- {
871
- "type": "string",
872
- },
873
- {
874
- "type": "number",
875
- },
876
- ],
877
- "type": "array",
878
- }
879
- `);
880
- });
881
-
882
- test("tuple with rest draft-7 - issue #5151 regression test", () => {
883
- // This test addresses issue #5151: tuple with rest elements and ids
884
- // in draft-7 had incorrect internal path handling affecting complex scenarios
885
- const primarySchema = z.string().meta({ id: "primary" });
886
- const restSchema = z.number().meta({ id: "rest" });
887
- const testSchema = z.tuple([primarySchema], restSchema);
888
-
889
- // Test both final output structure AND internal path handling
890
- const capturedPaths: string[] = [];
891
- const result = z.toJSONSchema(testSchema, {
892
- target: "draft-7",
893
- override: (ctx) => capturedPaths.push(ctx.path.join("/")),
894
- });
895
-
896
- // Verify correct draft-7 structure with metadata extraction
897
- expect(result).toMatchInlineSnapshot(`
898
- {
899
- "$schema": "http://json-schema.org/draft-07/schema#",
900
- "additionalItems": {
901
- "$ref": "#/definitions/rest",
902
- },
903
- "definitions": {
904
- "primary": {
905
- "id": "primary",
906
- "type": "string",
907
- },
908
- "rest": {
909
- "id": "rest",
910
- "type": "number",
911
- },
912
- },
913
- "items": [
914
- {
915
- "$ref": "#/definitions/primary",
916
- },
917
- ],
918
- "type": "array",
919
- }
920
- `);
921
-
922
- // Verify internal paths are correct (this was the actual bug)
923
- expect(capturedPaths).toContain("items/0"); // prefix items should use "items" path
924
- expect(capturedPaths).toContain("additionalItems"); // rest should use "additionalItems" path
925
- expect(capturedPaths).not.toContain("prefixItems/0"); // should not use draft-2020-12 paths
926
-
927
- // Structural validations
928
- expect(Array.isArray(result.items)).toBe(true);
929
- expect(result.additionalItems).toBeDefined();
930
- });
931
-
932
- test("promise", () => {
933
- const schema = z.promise(z.string());
934
- expect(z.toJSONSchema(schema)).toMatchInlineSnapshot(`
935
- {
936
- "$schema": "https://json-schema.org/draft/2020-12/schema",
937
- "type": "string",
938
- }
939
- `);
940
- });
941
-
942
- test("lazy", () => {
943
- const schema = z.lazy(() => z.string());
944
- expect(z.toJSONSchema(schema)).toMatchInlineSnapshot(`
945
- {
946
- "$schema": "https://json-schema.org/draft/2020-12/schema",
947
- "type": "string",
948
- }
949
- `);
950
- });
951
-
952
- // enum
953
- test("enum", () => {
954
- const a = z.enum(["a", "b", "c"]);
955
- expect(z.toJSONSchema(a)).toMatchInlineSnapshot(`
956
- {
957
- "$schema": "https://json-schema.org/draft/2020-12/schema",
958
- "enum": [
959
- "a",
960
- "b",
961
- "c",
962
- ],
963
- "type": "string",
964
- }
965
- `);
966
-
967
- enum B {
968
- A = 0,
969
- B = 1,
970
- C = 2,
971
- }
972
-
973
- const b = z.enum(B);
974
- expect(z.toJSONSchema(b)).toMatchInlineSnapshot(`
975
- {
976
- "$schema": "https://json-schema.org/draft/2020-12/schema",
977
- "enum": [
978
- 0,
979
- 1,
980
- 2,
981
- ],
982
- "type": "number",
983
- }
984
- `);
985
- });
986
-
987
- // literal
988
- test("literal", () => {
989
- const a = z.literal("hello");
990
- expect(z.toJSONSchema(a)).toMatchInlineSnapshot(`
991
- {
992
- "$schema": "https://json-schema.org/draft/2020-12/schema",
993
- "const": "hello",
994
- "type": "string",
995
- }
996
- `);
997
-
998
- const b = z.literal(7);
999
- expect(z.toJSONSchema(b)).toMatchInlineSnapshot(`
1000
- {
1001
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1002
- "const": 7,
1003
- "type": "number",
1004
- }
1005
- `);
1006
-
1007
- const c = z.literal(["hello", undefined, null, 5, BigInt(1324)]);
1008
- expect(() => z.toJSONSchema(c)).toThrow();
1009
-
1010
- const d = z.literal(["hello", null, 5]);
1011
- expect(z.toJSONSchema(d)).toMatchInlineSnapshot(`
1012
- {
1013
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1014
- "enum": [
1015
- "hello",
1016
- null,
1017
- 5,
1018
- ],
1019
- }
1020
- `);
1021
-
1022
- const e = z.literal(["hello", "zod", "v4"]);
1023
- expect(z.toJSONSchema(e)).toMatchInlineSnapshot(`
1024
- {
1025
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1026
- "enum": [
1027
- "hello",
1028
- "zod",
1029
- "v4",
1030
- ],
1031
- "type": "string",
1032
- }
1033
- `);
1034
- });
1035
-
1036
- test("literal draft-4", () => {
1037
- const a = z.literal("hello");
1038
- expect(z.toJSONSchema(a, { target: "draft-4" })).toMatchInlineSnapshot(`
1039
- {
1040
- "$schema": "http://json-schema.org/draft-04/schema#",
1041
- "enum": [
1042
- "hello",
1043
- ],
1044
- "type": "string",
1045
- }
1046
- `);
1047
- });
1048
-
1049
- // pipe
1050
- test("pipe", () => {
1051
- const schema = z
1052
- .string()
1053
- .transform((val) => Number.parseInt(val))
1054
- .pipe(z.number());
1055
- expect(z.toJSONSchema(schema)).toMatchInlineSnapshot(`
1056
- {
1057
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1058
- "type": "number",
1059
- }
1060
- `);
1061
- });
1062
-
1063
- test("simple objects", () => {
1064
- const schema = z.object({
1065
- name: z.string(),
1066
- age: z.number(),
1067
- });
1068
-
1069
- expect(z.toJSONSchema(schema)).toMatchInlineSnapshot(
1070
- `
1071
- {
1072
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1073
- "additionalProperties": false,
1074
- "properties": {
1075
- "age": {
1076
- "type": "number",
1077
- },
1078
- "name": {
1079
- "type": "string",
1080
- },
1081
- },
1082
- "required": [
1083
- "name",
1084
- "age",
1085
- ],
1086
- "type": "object",
1087
- }
1088
- `
1089
- );
1090
- });
1091
-
1092
- test("additionalproperties in z.object", () => {
1093
- const a = z.object({
1094
- name: z.string(),
1095
- });
1096
- expect(z.toJSONSchema(a)).toMatchInlineSnapshot(`
1097
- {
1098
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1099
- "additionalProperties": false,
1100
- "properties": {
1101
- "name": {
1102
- "type": "string",
1103
- },
1104
- },
1105
- "required": [
1106
- "name",
1107
- ],
1108
- "type": "object",
1109
- }
1110
- `);
1111
- expect(z.toJSONSchema(a, { io: "input" })).toMatchInlineSnapshot(`
1112
- {
1113
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1114
- "properties": {
1115
- "name": {
1116
- "type": "string",
1117
- },
1118
- },
1119
- "required": [
1120
- "name",
1121
- ],
1122
- "type": "object",
1123
- }
1124
- `);
1125
- expect(
1126
- z.toJSONSchema(a, {
1127
- io: "input",
1128
- override(ctx) {
1129
- const def = ctx.zodSchema._zod.def;
1130
- if (def.type === "object" && !def.catchall) {
1131
- (ctx.jsonSchema as z.core.JSONSchema.ObjectSchema).additionalProperties = false;
1132
- }
1133
- },
1134
- })
1135
- ).toMatchInlineSnapshot(`
1136
- {
1137
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1138
- "additionalProperties": false,
1139
- "properties": {
1140
- "name": {
1141
- "type": "string",
1142
- },
1143
- },
1144
- "required": [
1145
- "name",
1146
- ],
1147
- "type": "object",
1148
- }
1149
- `);
1150
- });
1151
-
1152
- test("catchall objects", () => {
1153
- const a = z.strictObject({
1154
- name: z.string(),
1155
- age: z.number(),
1156
- });
1157
-
1158
- expect(z.toJSONSchema(a)).toMatchInlineSnapshot(`
1159
- {
1160
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1161
- "additionalProperties": false,
1162
- "properties": {
1163
- "age": {
1164
- "type": "number",
1165
- },
1166
- "name": {
1167
- "type": "string",
1168
- },
1169
- },
1170
- "required": [
1171
- "name",
1172
- "age",
1173
- ],
1174
- "type": "object",
1175
- }
1176
- `);
1177
-
1178
- const b = z
1179
- .object({
1180
- name: z.string(),
1181
- })
1182
- .catchall(z.string());
1183
-
1184
- expect(z.toJSONSchema(b)).toMatchInlineSnapshot(`
1185
- {
1186
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1187
- "additionalProperties": {
1188
- "type": "string",
1189
- },
1190
- "properties": {
1191
- "name": {
1192
- "type": "string",
1193
- },
1194
- },
1195
- "required": [
1196
- "name",
1197
- ],
1198
- "type": "object",
1199
- }
1200
- `);
1201
-
1202
- const c = z.looseObject({
1203
- name: z.string(),
1204
- });
1205
-
1206
- expect(z.toJSONSchema(c)).toMatchInlineSnapshot(`
1207
- {
1208
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1209
- "additionalProperties": {},
1210
- "properties": {
1211
- "name": {
1212
- "type": "string",
1213
- },
1214
- },
1215
- "required": [
1216
- "name",
1217
- ],
1218
- "type": "object",
1219
- }
1220
- `);
1221
- });
1222
-
1223
- test("optional fields - object", () => {
1224
- const schema = z.object({
1225
- required: z.string(),
1226
- optional: z.string().optional(),
1227
- nonoptional: z.string().optional().nonoptional(),
1228
- });
1229
-
1230
- const result = z.toJSONSchema(schema);
1231
-
1232
- expect(result).toMatchInlineSnapshot(`
1233
- {
1234
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1235
- "additionalProperties": false,
1236
- "properties": {
1237
- "nonoptional": {
1238
- "type": "string",
1239
- },
1240
- "optional": {
1241
- "type": "string",
1242
- },
1243
- "required": {
1244
- "type": "string",
1245
- },
1246
- },
1247
- "required": [
1248
- "required",
1249
- "nonoptional",
1250
- ],
1251
- "type": "object",
1252
- }
1253
- `);
1254
- });
1255
-
1256
- test("recursive object", () => {
1257
- interface Category {
1258
- name: string;
1259
- subcategories: Category[];
1260
- }
1261
-
1262
- const categorySchema: z.ZodType<Category> = z.object({
1263
- name: z.string(),
1264
- subcategories: z.array(z.lazy(() => categorySchema)),
1265
- });
1266
-
1267
- const result = z.toJSONSchema(categorySchema);
1268
- expect(result).toMatchInlineSnapshot(`
1269
- {
1270
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1271
- "additionalProperties": false,
1272
- "properties": {
1273
- "name": {
1274
- "type": "string",
1275
- },
1276
- "subcategories": {
1277
- "items": {
1278
- "$ref": "#",
1279
- },
1280
- "type": "array",
1281
- },
1282
- },
1283
- "required": [
1284
- "name",
1285
- "subcategories",
1286
- ],
1287
- "type": "object",
1288
- }
1289
- `);
1290
- });
1291
-
1292
- test("simple interface", () => {
1293
- const userSchema = z.object({
1294
- name: z.string(),
1295
- age: z.number().optional(),
1296
- });
1297
-
1298
- const result = z.toJSONSchema(userSchema);
1299
- expect(result).toMatchInlineSnapshot(`
1300
- {
1301
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1302
- "additionalProperties": false,
1303
- "properties": {
1304
- "age": {
1305
- "type": "number",
1306
- },
1307
- "name": {
1308
- "type": "string",
1309
- },
1310
- },
1311
- "required": [
1312
- "name",
1313
- ],
1314
- "type": "object",
1315
- }
1316
- `);
1317
- });
1318
-
1319
- test("catchall interface", () => {
1320
- const a = z.strictObject({
1321
- name: z.string(),
1322
- age: z.number(),
1323
- });
1324
-
1325
- expect(z.toJSONSchema(a)).toMatchInlineSnapshot(`
1326
- {
1327
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1328
- "additionalProperties": false,
1329
- "properties": {
1330
- "age": {
1331
- "type": "number",
1332
- },
1333
- "name": {
1334
- "type": "string",
1335
- },
1336
- },
1337
- "required": [
1338
- "name",
1339
- "age",
1340
- ],
1341
- "type": "object",
1342
- }
1343
- `);
1344
-
1345
- const b = z
1346
- .object({
1347
- name: z.string(),
1348
- })
1349
- .catchall(z.string());
1350
-
1351
- expect(z.toJSONSchema(b)).toMatchInlineSnapshot(`
1352
- {
1353
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1354
- "additionalProperties": {
1355
- "type": "string",
1356
- },
1357
- "properties": {
1358
- "name": {
1359
- "type": "string",
1360
- },
1361
- },
1362
- "required": [
1363
- "name",
1364
- ],
1365
- "type": "object",
1366
- }
1367
- `);
1368
-
1369
- const c = z.looseObject({
1370
- name: z.string(),
1371
- });
1372
-
1373
- expect(z.toJSONSchema(c)).toMatchInlineSnapshot(`
1374
- {
1375
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1376
- "additionalProperties": {},
1377
- "properties": {
1378
- "name": {
1379
- "type": "string",
1380
- },
1381
- },
1382
- "required": [
1383
- "name",
1384
- ],
1385
- "type": "object",
1386
- }
1387
- `);
1388
- });
1389
-
1390
- test("recursive interface schemas", () => {
1391
- const TreeNodeSchema = z.object({
1392
- id: z.string(),
1393
- get children() {
1394
- return TreeNodeSchema;
1395
- },
1396
- });
1397
-
1398
- const result = z.toJSONSchema(TreeNodeSchema);
1399
-
1400
- // Should have definitions for recursive schema
1401
- expect(JSON.stringify(result, null, 2)).toMatchInlineSnapshot(
1402
- `
1403
- "{
1404
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1405
- "type": "object",
1406
- "properties": {
1407
- "id": {
1408
- "type": "string"
1409
- },
1410
- "children": {
1411
- "$ref": "#"
1412
- }
1413
- },
1414
- "required": [
1415
- "id",
1416
- "children"
1417
- ],
1418
- "additionalProperties": false
1419
- }"
1420
- `
1421
- );
1422
- });
1423
-
1424
- test("mutually recursive interface schemas", () => {
1425
- const FolderSchema = z.object({
1426
- name: z.string(),
1427
- get files() {
1428
- return z.array(FileSchema);
1429
- },
1430
- });
1431
-
1432
- const FileSchema = z.object({
1433
- name: z.string(),
1434
- get parent() {
1435
- return FolderSchema;
1436
- },
1437
- });
1438
-
1439
- const result = z.toJSONSchema(FolderSchema);
1440
-
1441
- // Should have definitions for both schemas
1442
- expect(JSON.stringify(result, null, 2)).toMatchInlineSnapshot(
1443
- `
1444
- "{
1445
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1446
- "type": "object",
1447
- "properties": {
1448
- "name": {
1449
- "type": "string"
1450
- },
1451
- "files": {
1452
- "type": "array",
1453
- "items": {
1454
- "type": "object",
1455
- "properties": {
1456
- "name": {
1457
- "type": "string"
1458
- },
1459
- "parent": {
1460
- "$ref": "#"
1461
- }
1462
- },
1463
- "required": [
1464
- "name",
1465
- "parent"
1466
- ],
1467
- "additionalProperties": false
1468
- }
1469
- }
1470
- },
1471
- "required": [
1472
- "name",
1473
- "files"
1474
- ],
1475
- "additionalProperties": false
1476
- }"
1477
- `
1478
- );
1479
- });
1480
- });
1481
-
1482
- test("override", () => {
1483
- const schema = z.z.toJSONSchema(z.string(), {
1484
- override: (ctx) => {
1485
- ctx.zodSchema;
1486
- ctx.jsonSchema;
1487
- ctx.jsonSchema.whatever = "sup";
1488
- },
1489
- });
1490
- expect(schema).toMatchInlineSnapshot(`
1491
- {
1492
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1493
- "type": "string",
1494
- "whatever": "sup",
1495
- }
1496
- `);
1497
- });
1498
-
1499
- test("override: do not run on references", () => {
1500
- let overrideCount = 0;
1501
- const schema = z
1502
- .union([z.string().date(), z.string().datetime(), z.string().datetime({ local: true })])
1503
- .meta({ a: true })
1504
- .transform((str) => new Date(str))
1505
- .meta({ b: true })
1506
- .pipe(z.date())
1507
- .meta({ c: true })
1508
- .brand("dateIn");
1509
- z.z.toJSONSchema(schema, {
1510
- unrepresentable: "any",
1511
- io: "input",
1512
- override(_) {
1513
- overrideCount++;
1514
- },
1515
- });
1516
-
1517
- expect(overrideCount).toBe(6);
1518
- });
1519
-
1520
- test("override with refs", () => {
1521
- const a = z.string().optional();
1522
- const result = z.z.toJSONSchema(a, {
1523
- override(ctx) {
1524
- if (ctx.zodSchema._zod.def.type === "string") {
1525
- ctx.jsonSchema.type = "STRING" as "string";
1526
- }
1527
- },
1528
- });
1529
-
1530
- expect(result).toMatchInlineSnapshot(`
1531
- {
1532
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1533
- "type": "STRING",
1534
- }
1535
- `);
1536
- });
1537
-
1538
- test("override execution order", () => {
1539
- const schema = z.union([z.string(), z.number()]);
1540
- let unionSchema!: any;
1541
- z.z.toJSONSchema(schema, {
1542
- override(ctx) {
1543
- if (ctx.zodSchema._zod.def.type === "union") {
1544
- unionSchema = ctx.jsonSchema;
1545
- }
1546
- },
1547
- });
1548
-
1549
- expect(unionSchema).toMatchInlineSnapshot(`
1550
- {
1551
- "anyOf": [
1552
- {
1553
- "type": "string",
1554
- },
1555
- {
1556
- "type": "number",
1557
- },
1558
- ],
1559
- }
1560
- `);
1561
- });
1562
-
1563
- test("override with path", () => {
1564
- const userSchema = z.object({
1565
- name: z.string(),
1566
- age: z.number(),
1567
- });
1568
-
1569
- const capturedPaths: (string | number)[][] = [];
1570
-
1571
- z.toJSONSchema(userSchema, {
1572
- override(ctx) {
1573
- capturedPaths.push(ctx.path);
1574
- },
1575
- });
1576
-
1577
- expect(capturedPaths).toMatchInlineSnapshot(`
1578
- [
1579
- [
1580
- "properties",
1581
- "age",
1582
- ],
1583
- [
1584
- "properties",
1585
- "name",
1586
- ],
1587
- [],
1588
- ]
1589
- `);
1590
- });
1591
-
1592
- test("pipe", () => {
1593
- const mySchema = z
1594
- .string()
1595
- .transform((val) => val.length)
1596
- .pipe(z.number());
1597
- // ZodPipe
1598
-
1599
- const a = z.z.toJSONSchema(mySchema);
1600
- expect(a).toMatchInlineSnapshot(`
1601
- {
1602
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1603
- "type": "number",
1604
- }
1605
- `);
1606
- // => { type: "number" }
1607
-
1608
- const b = z.z.toJSONSchema(mySchema, { io: "input" });
1609
- expect(b).toMatchInlineSnapshot(`
1610
- {
1611
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1612
- "type": "string",
1613
- }
1614
- `);
1615
- // => { type: "string" }
1616
- });
1617
-
1618
- test("passthrough schemas", () => {
1619
- const Internal = z.object({
1620
- num: z.number(),
1621
- str: z.string(),
1622
- });
1623
- //.meta({ id: "Internal" });
1624
-
1625
- const External = z.object({
1626
- a: Internal,
1627
- b: Internal.optional(),
1628
- c: z.lazy(() => Internal),
1629
- d: z.promise(Internal),
1630
- e: z.pipe(Internal, Internal),
1631
- });
1632
-
1633
- const result = z.z.toJSONSchema(External, {
1634
- reused: "ref",
1635
- });
1636
- expect(result).toMatchInlineSnapshot(`
1637
- {
1638
- "$defs": {
1639
- "__schema0": {
1640
- "additionalProperties": false,
1641
- "properties": {
1642
- "num": {
1643
- "type": "number",
1644
- },
1645
- "str": {
1646
- "type": "string",
1647
- },
1648
- },
1649
- "required": [
1650
- "num",
1651
- "str",
1652
- ],
1653
- "type": "object",
1654
- },
1655
- },
1656
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1657
- "additionalProperties": false,
1658
- "properties": {
1659
- "a": {
1660
- "$ref": "#/$defs/__schema0",
1661
- },
1662
- "b": {
1663
- "$ref": "#/$defs/__schema0",
1664
- },
1665
- "c": {
1666
- "$ref": "#/$defs/__schema0",
1667
- },
1668
- "d": {
1669
- "$ref": "#/$defs/__schema0",
1670
- },
1671
- "e": {
1672
- "$ref": "#/$defs/__schema0",
1673
- },
1674
- },
1675
- "required": [
1676
- "a",
1677
- "c",
1678
- "d",
1679
- "e",
1680
- ],
1681
- "type": "object",
1682
- }
1683
- `);
1684
- });
1685
-
1686
- test("extract schemas with id", () => {
1687
- const name = z.string().meta({ id: "name" });
1688
- const result = z.z.toJSONSchema(
1689
- z.object({
1690
- first_name: name,
1691
- last_name: name.nullable(),
1692
- middle_name: name.optional(),
1693
- age: z.number().meta({ id: "age" }),
1694
- })
1695
- );
1696
- expect(result).toMatchInlineSnapshot(`
1697
- {
1698
- "$defs": {
1699
- "age": {
1700
- "id": "age",
1701
- "type": "number",
1702
- },
1703
- "name": {
1704
- "id": "name",
1705
- "type": "string",
1706
- },
1707
- },
1708
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1709
- "additionalProperties": false,
1710
- "properties": {
1711
- "age": {
1712
- "$ref": "#/$defs/age",
1713
- },
1714
- "first_name": {
1715
- "$ref": "#/$defs/name",
1716
- },
1717
- "last_name": {
1718
- "anyOf": [
1719
- {
1720
- "$ref": "#/$defs/name",
1721
- },
1722
- {
1723
- "type": "null",
1724
- },
1725
- ],
1726
- },
1727
- "middle_name": {
1728
- "$ref": "#/$defs/name",
1729
- },
1730
- },
1731
- "required": [
1732
- "first_name",
1733
- "last_name",
1734
- "age",
1735
- ],
1736
- "type": "object",
1737
- }
1738
- `);
1739
- });
1740
-
1741
- test("unrepresentable literal values are ignored", () => {
1742
- const a = z.z.toJSONSchema(z.literal(["hello", null, 5, BigInt(1324), undefined]), { unrepresentable: "any" });
1743
- expect(a).toMatchInlineSnapshot(`
1744
- {
1745
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1746
- "enum": [
1747
- "hello",
1748
- null,
1749
- 5,
1750
- 1324,
1751
- ],
1752
- }
1753
- `);
1754
-
1755
- const b = z.z.toJSONSchema(z.literal([undefined, null, 5, BigInt(1324)]), {
1756
- unrepresentable: "any",
1757
- });
1758
- expect(b).toMatchInlineSnapshot(`
1759
- {
1760
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1761
- "enum": [
1762
- null,
1763
- 5,
1764
- 1324,
1765
- ],
1766
- }
1767
- `);
1768
-
1769
- const c = z.z.toJSONSchema(z.literal([undefined]), {
1770
- unrepresentable: "any",
1771
- });
1772
- expect(c).toMatchInlineSnapshot(`
1773
- {
1774
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1775
- }
1776
- `);
1777
- });
1778
-
1779
- test("describe with id", () => {
1780
- const jobId = z.string().meta({ id: "jobId" });
1781
-
1782
- const a = z.z.toJSONSchema(
1783
- z.object({
1784
- current: jobId.describe("Current job"),
1785
- previous: jobId.describe("Previous job"),
1786
- })
1787
- );
1788
- expect(a).toMatchInlineSnapshot(`
1789
- {
1790
- "$defs": {
1791
- "jobId": {
1792
- "id": "jobId",
1793
- "type": "string",
1794
- },
1795
- },
1796
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1797
- "additionalProperties": false,
1798
- "properties": {
1799
- "current": {
1800
- "$ref": "#/$defs/jobId",
1801
- "description": "Current job",
1802
- },
1803
- "previous": {
1804
- "$ref": "#/$defs/jobId",
1805
- "description": "Previous job",
1806
- },
1807
- },
1808
- "required": [
1809
- "current",
1810
- "previous",
1811
- ],
1812
- "type": "object",
1813
- }
1814
- `);
1815
- });
1816
-
1817
- test("overwrite id", () => {
1818
- const jobId = z.string().meta({ id: "aaa" });
1819
-
1820
- const a = z.z.toJSONSchema(
1821
- z.object({
1822
- current: jobId,
1823
- previous: jobId.meta({ id: "bbb" }),
1824
- })
1825
- );
1826
- expect(a).toMatchInlineSnapshot(`
1827
- {
1828
- "$defs": {
1829
- "aaa": {
1830
- "id": "aaa",
1831
- "type": "string",
1832
- },
1833
- "bbb": {
1834
- "$ref": "#/$defs/aaa",
1835
- "id": "bbb",
1836
- },
1837
- },
1838
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1839
- "additionalProperties": false,
1840
- "properties": {
1841
- "current": {
1842
- "$ref": "#/$defs/aaa",
1843
- },
1844
- "previous": {
1845
- "$ref": "#/$defs/bbb",
1846
- },
1847
- },
1848
- "required": [
1849
- "current",
1850
- "previous",
1851
- ],
1852
- "type": "object",
1853
- }
1854
- `);
1855
-
1856
- const b = z.z.toJSONSchema(
1857
- z.object({
1858
- current: jobId,
1859
- previous: jobId.meta({ id: "ccc" }),
1860
- }),
1861
- {
1862
- reused: "ref",
1863
- }
1864
- );
1865
- expect(b).toMatchInlineSnapshot(`
1866
- {
1867
- "$defs": {
1868
- "aaa": {
1869
- "id": "aaa",
1870
- "type": "string",
1871
- },
1872
- "ccc": {
1873
- "$ref": "#/$defs/aaa",
1874
- "id": "ccc",
1875
- },
1876
- },
1877
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1878
- "additionalProperties": false,
1879
- "properties": {
1880
- "current": {
1881
- "$ref": "#/$defs/aaa",
1882
- },
1883
- "previous": {
1884
- "$ref": "#/$defs/ccc",
1885
- },
1886
- },
1887
- "required": [
1888
- "current",
1889
- "previous",
1890
- ],
1891
- "type": "object",
1892
- }
1893
- `);
1894
- });
1895
-
1896
- test("overwrite descriptions", () => {
1897
- const field = z.string().describe("a").describe("b").describe("c");
1898
-
1899
- const a = z.z.toJSONSchema(
1900
- z.object({
1901
- d: field.describe("d"),
1902
- e: field.describe("e"),
1903
- })
1904
- );
1905
- expect(a).toMatchInlineSnapshot(`
1906
- {
1907
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1908
- "additionalProperties": false,
1909
- "properties": {
1910
- "d": {
1911
- "description": "d",
1912
- "type": "string",
1913
- },
1914
- "e": {
1915
- "description": "e",
1916
- "type": "string",
1917
- },
1918
- },
1919
- "required": [
1920
- "d",
1921
- "e",
1922
- ],
1923
- "type": "object",
1924
- }
1925
- `);
1926
-
1927
- const b = z.z.toJSONSchema(
1928
- z.object({
1929
- d: field.describe("d"),
1930
- e: field.describe("e"),
1931
- }),
1932
- {
1933
- reused: "ref",
1934
- }
1935
- );
1936
- expect(b).toMatchInlineSnapshot(`
1937
- {
1938
- "$defs": {
1939
- "__schema0": {
1940
- "description": "c",
1941
- "type": "string",
1942
- },
1943
- },
1944
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1945
- "additionalProperties": false,
1946
- "properties": {
1947
- "d": {
1948
- "$ref": "#/$defs/__schema0",
1949
- "description": "d",
1950
- },
1951
- "e": {
1952
- "$ref": "#/$defs/__schema0",
1953
- "description": "e",
1954
- },
1955
- },
1956
- "required": [
1957
- "d",
1958
- "e",
1959
- ],
1960
- "type": "object",
1961
- }
1962
- `);
1963
- });
1964
-
1965
- test("top-level readonly", () => {
1966
- const A = z
1967
- .object({
1968
- name: z.string(),
1969
- get b() {
1970
- return B;
1971
- },
1972
- })
1973
- .readonly()
1974
- .meta({ id: "A" });
1975
- // z.globalRegistry.add(A, { id: "A" });
1976
- // .meta({ id: "A" });
1977
-
1978
- const B = z
1979
- .object({
1980
- name: z.string(),
1981
- get a() {
1982
- return A;
1983
- },
1984
- })
1985
- .readonly()
1986
- .meta({ id: "B" });
1987
- // z.globalRegistry.add(B, { id: "B" });
1988
- // .meta({ id: "B" });
1989
-
1990
- const result = z.z.toJSONSchema(A);
1991
- expect(result).toMatchInlineSnapshot(`
1992
- {
1993
- "$defs": {
1994
- "B": {
1995
- "additionalProperties": false,
1996
- "id": "B",
1997
- "properties": {
1998
- "a": {
1999
- "$ref": "#",
2000
- },
2001
- "name": {
2002
- "type": "string",
2003
- },
2004
- },
2005
- "readOnly": true,
2006
- "required": [
2007
- "name",
2008
- "a",
2009
- ],
2010
- "type": "object",
2011
- },
2012
- },
2013
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2014
- "additionalProperties": false,
2015
- "id": "A",
2016
- "properties": {
2017
- "b": {
2018
- "$ref": "#/$defs/B",
2019
- },
2020
- "name": {
2021
- "type": "string",
2022
- },
2023
- },
2024
- "readOnly": true,
2025
- "required": [
2026
- "name",
2027
- "b",
2028
- ],
2029
- "type": "object",
2030
- }
2031
- `);
2032
- });
2033
-
2034
- test("basic registry", () => {
2035
- const myRegistry = z.registry<{ id: string }>();
2036
- const User = z.object({
2037
- name: z.string(),
2038
- get posts() {
2039
- return z.array(Post);
2040
- },
2041
- });
2042
-
2043
- const Post = z.object({
2044
- title: z.string(),
2045
- content: z.string(),
2046
- get author() {
2047
- return User;
2048
- },
2049
- });
2050
-
2051
- myRegistry.add(User, { id: "User" });
2052
- myRegistry.add(Post, { id: "Post" });
2053
-
2054
- const result = z.z.toJSONSchema(myRegistry, {
2055
- uri: (id) => `https://example.com/${id}.json`,
2056
- });
2057
- expect(result).toMatchInlineSnapshot(`
2058
- {
2059
- "schemas": {
2060
- "Post": {
2061
- "$id": "https://example.com/Post.json",
2062
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2063
- "additionalProperties": false,
2064
- "properties": {
2065
- "author": {
2066
- "$ref": "https://example.com/User.json",
2067
- },
2068
- "content": {
2069
- "type": "string",
2070
- },
2071
- "title": {
2072
- "type": "string",
2073
- },
2074
- },
2075
- "required": [
2076
- "title",
2077
- "content",
2078
- "author",
2079
- ],
2080
- "type": "object",
2081
- },
2082
- "User": {
2083
- "$id": "https://example.com/User.json",
2084
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2085
- "additionalProperties": false,
2086
- "properties": {
2087
- "name": {
2088
- "type": "string",
2089
- },
2090
- "posts": {
2091
- "items": {
2092
- "$ref": "https://example.com/Post.json",
2093
- },
2094
- "type": "array",
2095
- },
2096
- },
2097
- "required": [
2098
- "name",
2099
- "posts",
2100
- ],
2101
- "type": "object",
2102
- },
2103
- },
2104
- }
2105
- `);
2106
- });
2107
-
2108
- test("_ref", () => {
2109
- // const a = z.promise(z.string().describe("a"));
2110
- const a = z.z.toJSONSchema(z.promise(z.string().describe("a")));
2111
- expect(a).toMatchInlineSnapshot(`
2112
- {
2113
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2114
- "description": "a",
2115
- "type": "string",
2116
- }
2117
- `);
2118
-
2119
- const b = z.z.toJSONSchema(z.lazy(() => z.string().describe("a")));
2120
- expect(b).toMatchInlineSnapshot(`
2121
- {
2122
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2123
- "description": "a",
2124
- "type": "string",
2125
- }
2126
- `);
2127
-
2128
- const c = z.z.toJSONSchema(z.optional(z.string().describe("a")));
2129
- expect(c).toMatchInlineSnapshot(`
2130
- {
2131
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2132
- "description": "a",
2133
- "type": "string",
2134
- }
2135
- `);
2136
- });
2137
-
2138
- test("defaults/prefaults", () => {
2139
- const a = z
2140
- .string()
2141
- .transform((val) => val.length)
2142
- .pipe(z.number());
2143
- const b = a.prefault("hello");
2144
- const c = a.default(1234);
2145
-
2146
- // a
2147
- expect(z.toJSONSchema(a)).toMatchInlineSnapshot(`
2148
- {
2149
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2150
- "type": "number",
2151
- }
2152
- `);
2153
- expect(z.toJSONSchema(a, { io: "input" })).toMatchInlineSnapshot(`
2154
- {
2155
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2156
- "type": "string",
2157
- }
2158
- `);
2159
-
2160
- // b
2161
- expect(z.toJSONSchema(b)).toMatchInlineSnapshot(`
2162
- {
2163
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2164
- "type": "number",
2165
- }
2166
- `);
2167
- expect(z.toJSONSchema(b, { io: "input" })).toMatchInlineSnapshot(`
2168
- {
2169
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2170
- "default": "hello",
2171
- "type": "string",
2172
- }
2173
- `);
2174
- // c
2175
- expect(z.toJSONSchema(c)).toMatchInlineSnapshot(`
2176
- {
2177
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2178
- "default": 1234,
2179
- "type": "number",
2180
- }
2181
- `);
2182
- expect(z.toJSONSchema(c, { io: "input" })).toMatchInlineSnapshot(`
2183
- {
2184
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2185
- "type": "string",
2186
- }
2187
- `);
2188
- });
2189
-
2190
- test("input type", () => {
2191
- const schema = z.object({
2192
- a: z.string(),
2193
- b: z.string().optional(),
2194
- c: z.string().default("hello"),
2195
- d: z.string().nullable(),
2196
- e: z.string().prefault("hello"),
2197
- f: z.string().catch("hello"),
2198
- g: z.never(),
2199
- h: z.union([z.string(), z.number().default(2)]),
2200
- i: z.union([z.string(), z.string().optional()]),
2201
- });
2202
- expect(z.toJSONSchema(schema, { io: "input" })).toMatchInlineSnapshot(`
2203
- {
2204
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2205
- "properties": {
2206
- "a": {
2207
- "type": "string",
2208
- },
2209
- "b": {
2210
- "type": "string",
2211
- },
2212
- "c": {
2213
- "default": "hello",
2214
- "type": "string",
2215
- },
2216
- "d": {
2217
- "anyOf": [
2218
- {
2219
- "type": "string",
2220
- },
2221
- {
2222
- "type": "null",
2223
- },
2224
- ],
2225
- },
2226
- "e": {
2227
- "default": "hello",
2228
- "type": "string",
2229
- },
2230
- "f": {
2231
- "default": "hello",
2232
- "type": "string",
2233
- },
2234
- "g": {
2235
- "not": {},
2236
- },
2237
- "h": {
2238
- "anyOf": [
2239
- {
2240
- "type": "string",
2241
- },
2242
- {
2243
- "default": 2,
2244
- "type": "number",
2245
- },
2246
- ],
2247
- },
2248
- "i": {
2249
- "anyOf": [
2250
- {
2251
- "type": "string",
2252
- },
2253
- {
2254
- "type": "string",
2255
- },
2256
- ],
2257
- },
2258
- },
2259
- "required": [
2260
- "a",
2261
- "d",
2262
- "f",
2263
- "g",
2264
- ],
2265
- "type": "object",
2266
- }
2267
- `);
2268
- expect(z.toJSONSchema(schema, { io: "output" })).toMatchInlineSnapshot(`
2269
- {
2270
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2271
- "additionalProperties": false,
2272
- "properties": {
2273
- "a": {
2274
- "type": "string",
2275
- },
2276
- "b": {
2277
- "type": "string",
2278
- },
2279
- "c": {
2280
- "default": "hello",
2281
- "type": "string",
2282
- },
2283
- "d": {
2284
- "anyOf": [
2285
- {
2286
- "type": "string",
2287
- },
2288
- {
2289
- "type": "null",
2290
- },
2291
- ],
2292
- },
2293
- "e": {
2294
- "type": "string",
2295
- },
2296
- "f": {
2297
- "default": "hello",
2298
- "type": "string",
2299
- },
2300
- "g": {
2301
- "not": {},
2302
- },
2303
- "h": {
2304
- "anyOf": [
2305
- {
2306
- "type": "string",
2307
- },
2308
- {
2309
- "default": 2,
2310
- "type": "number",
2311
- },
2312
- ],
2313
- },
2314
- "i": {
2315
- "anyOf": [
2316
- {
2317
- "type": "string",
2318
- },
2319
- {
2320
- "type": "string",
2321
- },
2322
- ],
2323
- },
2324
- },
2325
- "required": [
2326
- "a",
2327
- "c",
2328
- "d",
2329
- "e",
2330
- "f",
2331
- "g",
2332
- "h",
2333
- ],
2334
- "type": "object",
2335
- }
2336
- `);
2337
- });
2338
-
2339
- test("examples on pipe", () => {
2340
- const schema = z
2341
- .string()
2342
- .meta({ examples: ["test"] })
2343
- .transform(Number)
2344
- // .pipe(z.transform(Number).meta({ examples: [4] }))
2345
- .meta({ examples: [4] });
2346
-
2347
- const i = z.z.toJSONSchema(schema, { io: "input", unrepresentable: "any" });
2348
- expect(i).toMatchInlineSnapshot(`
2349
- {
2350
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2351
- "examples": [
2352
- "test",
2353
- ],
2354
- "type": "string",
2355
- }
2356
- `);
2357
- const o = z.z.toJSONSchema(schema, { io: "output", unrepresentable: "any" });
2358
- expect(o).toMatchInlineSnapshot(`
2359
- {
2360
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2361
- "examples": [
2362
- 4,
2363
- ],
2364
- }
2365
- `);
2366
- });
2367
-
2368
- // test("number checks", () => {
2369
- // expect(z.z.toJSONSchema(z.number().int())).toMatchInlineSnapshot(`
2370
- // {
2371
- // "maximum": 9007199254740991,
2372
- // "minimum": -9007199254740991,
2373
- // "type": "integer",
2374
- // }
2375
- // `);
2376
- // expect(z.z.toJSONSchema(z.int())).toMatchInlineSnapshot(`
2377
- // {
2378
- // "maximum": 9007199254740991,
2379
- // "minimum": -9007199254740991,
2380
- // "type": "integer",
2381
- // }
2382
- // `);
2383
- // expect(z.z.toJSONSchema(z.int().positive())).toMatchInlineSnapshot(`
2384
- // {
2385
- // "exclusiveMinimum": 0,
2386
- // "maximum": 9007199254740991,
2387
- // "minimum": -9007199254740991,
2388
- // "type": "integer",
2389
- // }
2390
- // `);
2391
- // expect(z.z.toJSONSchema(z.int().nonnegative())).toMatchInlineSnapshot(`
2392
- // {
2393
- // "maximum": 9007199254740991,
2394
- // "minimum": 0,
2395
- // "type": "integer",
2396
- // }
2397
- // `);
2398
- // expect(z.z.toJSONSchema(z.int().gt(0))).toMatchInlineSnapshot(`
2399
- // {
2400
- // "exclusiveMinimum": 0,
2401
- // "maximum": 9007199254740991,
2402
- // "minimum": -9007199254740991,
2403
- // "type": "integer",
2404
- // }
2405
- // `);
2406
- // expect(z.z.toJSONSchema(z.int().gte(0))).toMatchInlineSnapshot(`
2407
- // {
2408
- // "maximum": 9007199254740991,
2409
- // "minimum": 0,
2410
- // "type": "integer",
2411
- // }
2412
- // `);
2413
-
2414
- // });
2415
-
2416
- test("use output type for preprocess", () => {
2417
- const a = z.preprocess((val) => String(val), z.string());
2418
-
2419
- expect(z.toJSONSchema(a, { io: "input" })).toMatchInlineSnapshot(`
2420
- {
2421
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2422
- "type": "string",
2423
- }
2424
- `);
2425
- });
2426
-
2427
- // test("isTransforming", () => {
2428
- // const tx = z.core.isTransforming;
2429
- // expect(tx(z.string())).toEqual(false);
2430
- // expect(tx(z.string().transform((val) => val))).toEqual(true);
2431
- // expect(tx(z.string().pipe(z.string()))).toEqual(false);
2432
- // expect(
2433
- // tx(
2434
- // z
2435
- // .string()
2436
- // .transform((val) => val)
2437
- // .pipe(z.string())
2438
- // )
2439
- // ).toEqual(true);
2440
-
2441
- // const a = z.transform((val) => val);
2442
- // expect(tx(z.transform((val) => val))).toEqual(true);
2443
- // expect(tx(a.optional())).toEqual(true);
2444
-
2445
- // const b = z.string().optional();
2446
- // expect(tx(b)).toEqual(false);
2447
-
2448
- // const c = z.string().prefault("hello");
2449
- // expect(tx(c)).toEqual(false);
2450
-
2451
- // const d = z.string().default("hello");
2452
- // expect(tx(d)).toEqual(false);
2453
- // });
2454
-
2455
- test("flatten simple intersections", () => {
2456
- const FirstSchema = z.object({
2457
- testNum: z.number(),
2458
- });
2459
-
2460
- const SecondSchema = z.object({
2461
- testStr: z.string(),
2462
- });
2463
-
2464
- const ThirdSchema = z.object({
2465
- testBool: z.boolean(),
2466
- });
2467
-
2468
- const HelloSchema = FirstSchema.and(SecondSchema).and(ThirdSchema).describe("123");
2469
-
2470
- // Zod 3
2471
- // console.log(JSON.stringify(zodToJsonSchema(HelloSchema), null, 2));
2472
-
2473
- // Zod 4
2474
- const result = z.toJSONSchema(HelloSchema, { target: "draft-7" });
2475
- expect(result).toMatchInlineSnapshot(`
2476
- {
2477
- "$schema": "http://json-schema.org/draft-07/schema#",
2478
- "allOf": [
2479
- {
2480
- "additionalProperties": false,
2481
- "properties": {
2482
- "testNum": {
2483
- "type": "number",
2484
- },
2485
- },
2486
- "required": [
2487
- "testNum",
2488
- ],
2489
- "type": "object",
2490
- },
2491
- {
2492
- "additionalProperties": false,
2493
- "properties": {
2494
- "testStr": {
2495
- "type": "string",
2496
- },
2497
- },
2498
- "required": [
2499
- "testStr",
2500
- ],
2501
- "type": "object",
2502
- },
2503
- {
2504
- "additionalProperties": false,
2505
- "properties": {
2506
- "testBool": {
2507
- "type": "boolean",
2508
- },
2509
- },
2510
- "required": [
2511
- "testBool",
2512
- ],
2513
- "type": "object",
2514
- },
2515
- ],
2516
- "description": "123",
2517
- }
2518
- `);
2519
- });
2520
-
2521
- test("z.file()", () => {
2522
- const a = z.file();
2523
- expect(z.toJSONSchema(a)).toMatchInlineSnapshot(`
2524
- {
2525
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2526
- "contentEncoding": "binary",
2527
- "format": "binary",
2528
- "type": "string",
2529
- }
2530
- `);
2531
-
2532
- const b = z.file().mime("image/png").min(1000).max(10000);
2533
- expect(z.toJSONSchema(b)).toMatchInlineSnapshot(`
2534
- {
2535
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2536
- "contentEncoding": "binary",
2537
- "contentMediaType": "image/png",
2538
- "format": "binary",
2539
- "maxLength": 10000,
2540
- "minLength": 1000,
2541
- "type": "string",
2542
- }
2543
- `);
2544
-
2545
- const c = z.file().mime(["image/png", "image/jpg"]).min(1000).max(10000);
2546
- expect(z.toJSONSchema(c)).toMatchInlineSnapshot(`
2547
- {
2548
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2549
- "anyOf": [
2550
- {
2551
- "contentEncoding": "binary",
2552
- "contentMediaType": "image/png",
2553
- "format": "binary",
2554
- "maxLength": 10000,
2555
- "minLength": 1000,
2556
- "type": "string",
2557
- },
2558
- {
2559
- "contentEncoding": "binary",
2560
- "contentMediaType": "image/jpg",
2561
- "format": "binary",
2562
- "maxLength": 10000,
2563
- "minLength": 1000,
2564
- "type": "string",
2565
- },
2566
- ],
2567
- }
2568
- `);
2569
- });
2570
-
2571
- test("custom toJSONSchema", () => {
2572
- const schema = z.instanceof(Date);
2573
- schema._zod.toJSONSchema = () => ({
2574
- type: "string",
2575
- format: "date-time",
2576
- });
2577
-
2578
- expect(z.toJSONSchema(schema)).toMatchInlineSnapshot(`
2579
- {
2580
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2581
- "format": "date-time",
2582
- "type": "string",
2583
- }
2584
- `);
2585
- });
2586
-
2587
- test("cycle detection - root", () => {
2588
- const schema = z.object({
2589
- name: z.string(),
2590
- get subcategories() {
2591
- return z.array(schema);
2592
- },
2593
- });
2594
-
2595
- expect(() => z.toJSONSchema(schema, { cycles: "throw" })).toThrowErrorMatchingInlineSnapshot(`
2596
- [Error: Cycle detected: #/properties/subcategories/items/<root>
2597
-
2598
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.]
2599
- `);
2600
- });
2601
-
2602
- test("cycle detection - mutual recursion", () => {
2603
- const A = z.object({
2604
- name: z.string(),
2605
- get subcategories() {
2606
- return z.array(B);
2607
- },
2608
- });
2609
-
2610
- const B = z.object({
2611
- name: z.string(),
2612
- get subcategories() {
2613
- return z.array(A);
2614
- },
2615
- });
2616
-
2617
- expect(() => z.toJSONSchema(A, { cycles: "throw" })).toThrowErrorMatchingInlineSnapshot(`
2618
- [Error: Cycle detected: #/properties/subcategories/items/properties/subcategories/items/<root>
2619
-
2620
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.]
2621
- `);
2622
- });