Skip to content

Commit 446c164

Browse files
committed
docs(zod): adds StackBlitz for zx.convertCaseCodec, zx.deepCamelCaseCodec and zx.deepSnakeCaseCodec
1 parent da1d0e0 commit 446c164

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

.changeset/wise-beans-sip.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@traversable/zod": patch
3+
---
4+
5+
docs(zod): adds StackBlitz for `zx.convertCaseCodec`, `zx.deepCamelCaseCodec` and `zx.deepSnakeCaseCodec`

packages/zod/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,9 @@ Convert a zod schema into a codec that applies a bi-directional **key transforma
438438

439439
#### Example
440440

441+
> [!NOTE]
442+
> You can play with this example on [StackBlitz](https://stackblitz.com/edit/traversable-zod-snakecase-camelcase?file=test%2Fdemo.test.ts&initialPath=__vitest__/)
443+
441444
```typescript
442445
import * as z from 'zod'
443446
import { zx } from '@traversable/zod'
@@ -510,13 +513,19 @@ console.log(
510513

511514
### `zx.deepCamelCaseCodec` (🔬)
512515

516+
> [!WARN]
517+
> Support for this feature is **experimental**.
518+
513519
Convert a zod schema into a codec that **decodes any objects's keys to camel case** and **encode any object's keys to snake case**, recursively.
514520

515521
> [!NOTE]
516522
> This feature was implemented in terms of [`zx.convertCaseCodec`](https://github.com/traversable/schema/tree/main/packages/zod#zxconvertcasecodec).
517523
518524
#### Example
519525

526+
> [!NOTE]
527+
> You can play with this example on [StackBlitz](https://stackblitz.com/edit/traversable-zod-snakecase-camelcase?file=test%2Fdemo.test.ts&initialPath=__vitest__/)
528+
520529
```typescript
521530
import * as z from 'zod'
522531
import { zx } from '@traversable/zod'
@@ -605,13 +614,19 @@ console.log(
605614

606615
### `zx.deepSnakeCaseCodec` (🔬)
607616

617+
> [!WARN]
618+
> Support for this feature is **experimental**.
619+
608620
Convert a zod schema into a codec that **decodes any objects's keys to snake case** and **encode any object's keys to camel case**, recursively.
609621

610622
> [!NOTE]
611623
> This feature was implemented in terms of [`zx.convertCaseCodec`](https://github.com/traversable/schema/tree/main/packages/zod#zxconvertcasecodec).
612624
613625
#### Example
614626

627+
> [!NOTE]
628+
> You can play with this example on [StackBlitz](https://stackblitz.com/edit/traversable-zod-snakecase-camelcase?file=test%2Fdemo.test.ts&initialPath=__vitest__/)
629+
615630
```typescript
616631
import * as z from 'zod'
617632
import { zx } from '@traversable/zod'

packages/zod/test/convert-case-codec.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import * as vi from 'vitest'
22
import { z } from 'zod'
33
import { zx } from '@traversable/zod'
4-
import prettier from '@prettier/sync'
5-
6-
const format = (src: string) => prettier.format(src, { parser: 'typescript', printWidth: 60 })
74

85
vi.describe('〖⛳️〗‹‹‹ ❲@traversable/zod❳', () => {
96
vi.test('〖⛳️〗› ❲camelCase❳', () => {

0 commit comments

Comments
 (0)