Skip to content

Conversation

@ahrjarrett
Copy link
Member

@ahrjarrett ahrjarrett commented Sep 20, 2025

Closes #522

new features

This change adds a new transformer for the @traversable/zod package that uses a new feature that was added in zod v4: codecs.

Because of how easy zx.fold is to work with, implementing zx.convertCaseCodec was relatively simple, and took me about an hour.

Usually I'd fuzz test the hell out of it before publishing, but this time I figured I'd release these early, to have a chance for users to use it and provide feedback before I go through the trouble.

Note

Currently there is no type-level support for these transformers. I'm still trying to decide if doing that would be a good idea.

My current thinking is that it would be better to implement .writeable variants (for example, zx.deepCamelCaseCodec.writeable) – if we did that, it would be trivial to also generate the to/from types as well using zx.toType.

If you use this and run into any problems, please don't hesitate to open an issue!

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 20, 2025

Open in StackBlitz

@traversable/arktype

npm i https://pkg.pr.new/traversable/schema/@traversable/arktype@523

@traversable/arktype-test

npm i https://pkg.pr.new/traversable/schema/@traversable/arktype-test@523

@traversable/arktype-types

npm i https://pkg.pr.new/traversable/schema/@traversable/arktype-types@523

@traversable/json

npm i https://pkg.pr.new/traversable/schema/@traversable/json@523

@traversable/json-schema

npm i https://pkg.pr.new/traversable/schema/@traversable/json-schema@523

@traversable/json-schema-test

npm i https://pkg.pr.new/traversable/schema/@traversable/json-schema-test@523

@traversable/json-schema-types

npm i https://pkg.pr.new/traversable/schema/@traversable/json-schema-types@523

@traversable/registry

npm i https://pkg.pr.new/traversable/schema/@traversable/registry@523

@traversable/schema

npm i https://pkg.pr.new/traversable/schema/@traversable/schema@523

@traversable/schema-codec

npm i https://pkg.pr.new/traversable/schema/@traversable/schema-codec@523

@traversable/schema-compiler

npm i https://pkg.pr.new/traversable/schema/@traversable/schema-compiler@523

@traversable/schema-deep-equal

npm i https://pkg.pr.new/traversable/schema/@traversable/schema-deep-equal@523

@traversable/schema-errors

npm i https://pkg.pr.new/traversable/schema/@traversable/schema-errors@523

@traversable/schema-seed

npm i https://pkg.pr.new/traversable/schema/@traversable/schema-seed@523

@traversable/schema-to-json-schema

npm i https://pkg.pr.new/traversable/schema/@traversable/schema-to-json-schema@523

@traversable/schema-to-string

npm i https://pkg.pr.new/traversable/schema/@traversable/schema-to-string@523

@traversable/schema-to-validator

npm i https://pkg.pr.new/traversable/schema/@traversable/schema-to-validator@523

@traversable/typebox

npm i https://pkg.pr.new/traversable/schema/@traversable/typebox@523

@traversable/typebox-test

npm i https://pkg.pr.new/traversable/schema/@traversable/typebox-test@523

@traversable/typebox-types

npm i https://pkg.pr.new/traversable/schema/@traversable/typebox-types@523

@traversable/valibot

npm i https://pkg.pr.new/traversable/schema/@traversable/valibot@523

@traversable/valibot-test

npm i https://pkg.pr.new/traversable/schema/@traversable/valibot-test@523

@traversable/valibot-types

npm i https://pkg.pr.new/traversable/schema/@traversable/valibot-types@523

@traversable/zod

npm i https://pkg.pr.new/traversable/schema/@traversable/zod@523

@traversable/zod-test

npm i https://pkg.pr.new/traversable/schema/@traversable/zod-test@523

@traversable/zod-types

npm i https://pkg.pr.new/traversable/schema/@traversable/zod-types@523

commit: c70e3d1

@ahrjarrett ahrjarrett merged commit d355470 into main Sep 20, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(zod): add a way for users to recursively convert a zod schema into a codec that applies arbitrary key transformations

2 participants