testnet
testnet copied to clipboard
fix(deps): update dependency zod to ^3.23.8
This PR contains the following updates:
Package | Change | Age | Adoption | Passing | Confidence |
---|---|---|---|---|---|
zod (source) | ^3.22.4 -> ^3.23.8 |
Release Notes
colinhacks/zod (zod)
v3.23.8
Commits:
-
0f4d403
Add Bronze logos (#3470) -
1968731
Tweak tiers (#3471) -
eda7df3
Change RefinementCtx to interface -
ca42965
v3.23.8
v3.23.7
v3.23.6
v3.23.5
v3.23.4
Commits:
v3.23.3
v3.23.2
Commits:
v3.23.1
v3.23.0
Zod 3.23 is now available. This is the final 3.x
release before Zod 4.0. To try it out:
npm install zod
Features
z.string().date()
Zod can now validate ISO 8601 date strings. Thanks @igalklebanov! https://github.com/colinhacks/zod/pull/1766
const schema = z.string().date();
schema.parse("2022-01-01"); // OK
z.string().time()
Zod can now validate ISO 8601 time strings. Thanks @igalklebanov! https://github.com/colinhacks/zod/pull/1766
const schema = z.string().time();
schema.parse("12:00:00"); // OK
You can specify sub-second precision using the precision
option:
const schema = z.string().time({ precision: 3 });
schema.parse("12:00:00.123"); // OK
schema.parse("12:00:00.123456"); // Error
schema.parse("12:00:00"); // Error
z.string().duration()
Zod can now validate ISO 8601 duration strings. Thanks @mastermatt! https://github.com/colinhacks/zod/pull/3265
const schema = z.string().duration();
schema.parse("P3Y6M4DT12H30M5S"); // OK
Improvements to z.string().datetime()
Thanks @bchrobot https://github.com/colinhacks/zod/pull/2522
You can now allow unqualified (timezone-less) datetimes using the local: true
flag.
const schema = z.string().datetime({ local: true });
schema.parse("2022-01-01T12:00:00"); // OK
Plus, Zod now validates the day-of-month correctly to ensure no invalid dates (e.g. February 30th) pass validation. Thanks @szamanr! https://github.com/colinhacks/zod/pull/3391
z.string().base64()
Zod can now validate base64 strings. Thanks @StefanTerdell! https://github.com/colinhacks/zod/pull/3047
const schema = z.string().base64();
schema.parse("SGVsbG8gV29ybGQ="); // OK
Improved discriminated unions
The following can now be used as discriminator keys in z.discriminatedUnion()
:
-
ZodOptional
-
ZodNullable
-
ZodReadonly
-
ZodBranded
-
ZodCatch
const schema = z.discriminatedUnion("type", [
z.object({ type: z.literal("A").optional(), value: z.number() }),
z.object({ type: z.literal("B").nullable(), value: z.string() }),
z.object({ type: z.literal("C").readonly(), value: z.boolean() }),
z.object({ type: z.literal("D").brand<"D">(), value: z.boolean() }),
z.object({ type: z.literal("E").catch("E"), value: z.unknown() }),
]);
Misc
- feature: allow falsy error message by @fernandollisboa in https://github.com/colinhacks/zod/pull/3178
- feature: add attribute message to enum validatiion by @fernandollisboa in https://github.com/colinhacks/zod/pull/3169
Breaking changes
There are no breaking changes to the public API of Zod. However some changes can impact ecosystem tools that rely on Zod internals.
ZodFirstPartySchemaTypes
Three new types have been added to the ZodFirstPartySchemaTypes
union. This may impact some codegen libraries. https://github.com/colinhacks/zod/pull/3247
+ | ZodPipeline<any, any>
+ | ZodReadonly<any>
+ | ZodSymbol;
Default generics in ZodType
The third argument of the ZodType
base class now defaults to unknown
. This makes it easier to define recursive schemas and write generic functions that accept Zod schemas.
- class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {}
+ class ZodType<Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = unknown> {}
Unrecognized keys in .pick()
and .omit()
This version fixes a bug where unknown keys were accidentally accepted in .pick()
and omit()
. This has been fixed, which could cause compiler errors in some user code. https://github.com/colinhacks/zod/pull/3255
z.object({
name: z.string()
}).pick({
notAKey: true // no longer allowed
})
Bugfixes and performance
- Bugfix: Enum.extract/exclude should not remove error mapping by @shaharke in https://github.com/colinhacks/zod/pull/3240
- Added latest stable Node and TypeScript versions to test matrix for up-to-date testing. by @m10rten in https://github.com/colinhacks/zod/pull/3278
- Add types to
ZodFirstPartySchemaTypes
by @MatthijsMud in https://github.com/colinhacks/zod/pull/3247 - fix: make
input
of.required()
readonly by @KATT in https://github.com/colinhacks/zod/pull/3301 - add never props to safe parse return types by @schicks in https://github.com/colinhacks/zod/pull/3295
- Reporting errors of the preprocess that is the second property of object by @yukukotani in https://github.com/colinhacks/zod/pull/2912
- Improve
addQuestionMarks
, fix #2184 by @colinhacks in https://github.com/colinhacks/zod/pull/3352 - fix for njs by @dvv in https://github.com/colinhacks/zod/pull/3063
- only look in
src
forbun test
by @rotu in https://github.com/colinhacks/zod/pull/3038 - Restrict .pick()/.omit() mask type to only known properties by @petrovmiroslav in https://github.com/colinhacks/zod/pull/3255
- Make EnumValues generic by @IlyaSemenov in https://github.com/colinhacks/zod/pull/2338
- perf: avoid unnecessary error maps by @xuxucode in https://github.com/colinhacks/zod/pull/2532
- Bugfix: z.record().parse should not filter out undefined values by @raik-casimiro in https://github.com/colinhacks/zod/pull/3251
- Use Set.has instead of Array.indexOf for enum comparison (perf improvement) by @jmike in https://github.com/colinhacks/zod/pull/2659
- [2888] fix emails with single quotes failing validation by @Mansehej in https://github.com/colinhacks/zod/pull/2889
- Bugfix: Commas are incorrectly allowed in email regex. by @mokemoko in https://github.com/colinhacks/zod/pull/3286
- Fix regex in cuid2 validation to be what cuid2 library expects by @etareduction in https://github.com/colinhacks/zod/pull/2961
- Make depcruise pass by @rotu in https://github.com/colinhacks/zod/pull/3037
- Faster ipv4 parsing by @colinhacks in https://github.com/colinhacks/zod/pull/3413
Docs and ecosystem
- chore: add pastel package to ecosystem by @jlarmstrongiv in https://github.com/colinhacks/zod/pull/2949
- added required styles. by @Ansh101112 in https://github.com/colinhacks/zod/pull/2955
- Feature/better chinese translate by @NWYLZW in https://github.com/colinhacks/zod/pull/2988
- Fix z.instanceof example by @alexnault in https://github.com/colinhacks/zod/pull/3003
- Add documentation to Zod enum exclude/extract functions by @shaharke in https://github.com/colinhacks/zod/pull/3044
- Add docs for coercing nullish values by @rbuetzer in https://github.com/colinhacks/zod/pull/3067
- Adds
zod-dev
utility to eco-system section by @schalkventer in https://github.com/colinhacks/zod/pull/3113 - Add zhttp library to docs by @evertdespiegeleer in https://github.com/colinhacks/zod/pull/3134
- fixed Readme typo in NaNs example by @RashJrEdmund in https://github.com/colinhacks/zod/pull/3181
- adds zod-config library to the ecosystem by @alexmarqs in https://github.com/colinhacks/zod/pull/3200
- docs: update link and description of conform integration by @g1eny0ung in https://github.com/colinhacks/zod/pull/3238
- Update README.md by @yugmade13 in https://github.com/colinhacks/zod/pull/3317
- feat: overhaul generics section of readme to include more details on z.ZodTypeAny usage by @braden-w in https://github.com/colinhacks/zod/pull/3321
- Fix small typos by @mmorearty in https://github.com/colinhacks/zod/pull/3336
- docs: update Chinese docs and correct some of the typos by @jiechen257 in https://github.com/colinhacks/zod/pull/3338
- docs: improve chinese readme by @luckrnx09 in https://github.com/colinhacks/zod/pull/3371
- Add java-to-zod in X to Zod section by @ivangreene in https://github.com/colinhacks/zod/pull/3385
- docs: add
orval
to "X to Zod" ecosystems by @soartec-lab in https://github.com/colinhacks/zod/pull/3397
New Contributors
- @jlarmstrongiv made their first contribution in https://github.com/colinhacks/zod/pull/2949
- @Ansh101112 made their first contribution in https://github.com/colinhacks/zod/pull/2955
- @NWYLZW made their first contribution in https://github.com/colinhacks/zod/pull/2988
- @alexnault made their first contribution in https://github.com/colinhacks/zod/pull/3003
- @shaharke made their first contribution in https://github.com/colinhacks/zod/pull/3044
- @rbuetzer made their first contribution in https://github.com/colinhacks/zod/pull/3067
- @schalkventer made their first contribution in https://github.com/colinhacks/zod/pull/3113
- @evertdespiegeleer made their first contribution in https://github.com/colinhacks/zod/pull/3134
- @RashJrEdmund made their first contribution in https://github.com/colinhacks/zod/pull/3181
- @alexmarqs made their first contribution in https://github.com/colinhacks/zod/pull/3200
- @JonnyBurger made their first contribution in https://github.com/colinhacks/zod/pull/3214
- @fernandollisboa made their first contribution in https://github.com/colinhacks/zod/pull/3178
- @g1eny0ung made their first contribution in https://github.com/colinhacks/zod/pull/3238
- @m10rten made their first contribution in https://github.com/colinhacks/zod/pull/3278
- @MatthijsMud made their first contribution in https://github.com/colinhacks/zod/pull/3247
- @yugmade13 made their first contribution in https://github.com/colinhacks/zod/pull/3317
- @braden-w made their first contribution in https://github.com/colinhacks/zod/pull/3321
- @mmorearty made their first contribution in https://github.com/colinhacks/zod/pull/3336
- @schicks made their first contribution in https://github.com/colinhacks/zod/pull/3295
- @yukukotani made their first contribution in https://github.com/colinhacks/zod/pull/2912
- @jiechen257 made their first contribution in https://github.com/colinhacks/zod/pull/3338
- @luckrnx09 made their first contribution in https://github.com/colinhacks/zod/pull/3371
- @dvv made their first contribution in https://github.com/colinhacks/zod/pull/3063
- @rotu made their first contribution in https://github.com/colinhacks/zod/pull/3038
- @petrovmiroslav made their first contribution in https://github.com/colinhacks/zod/pull/3255
- @ivoilic made their first contribution in https://github.com/colinhacks/zod/pull/2364
- @telemakhos made their first contribution in https://github.com/colinhacks/zod/pull/3388
- @bchrobot made their first contribution in https://github.com/colinhacks/zod/pull/2522
- @szamanr made their first contribution in https://github.com/colinhacks/zod/pull/3391
- @ivangreene made their first contribution in https://github.com/colinhacks/zod/pull/3385
- @xuxucode made their first contribution in https://github.com/colinhacks/zod/pull/2532
- @raik-casimiro made their first contribution in https://github.com/colinhacks/zod/pull/3251
- @jmike made their first contribution in https://github.com/colinhacks/zod/pull/2659
- @Mansehej made their first contribution in https://github.com/colinhacks/zod/pull/2889
- @mokemoko made their first contribution in https://github.com/colinhacks/zod/pull/3286
- @etareduction made their first contribution in https://github.com/colinhacks/zod/pull/2961
- @mastermatt made their first contribution in https://github.com/colinhacks/zod/pull/3265
- @soartec-lab made their first contribution in https://github.com/colinhacks/zod/pull/3397
Full Changelog: https://github.com/colinhacks/zod/compare/v3.22.4...v3.23.0
v3.22.5
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
- [ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.