Skip to content

Commit 5958ea2

Browse files
committed
Update docs and bump to 0.4.0
1 parent 8ff1cf3 commit 5958ea2

File tree

5 files changed

+12
-86
lines changed

5 files changed

+12
-86
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ A library that creates [Zod](https://github.com/colinhacks/zod) types from [JSON
1111
npm install zod-from-json-schema
1212
```
1313

14+
## Zod 3 vs 4
15+
16+
- If you need Zod 4, use the latest version of this package.
17+
- If you need Zod 3, use the latest version that's less than 0.4.0 (at the of writing that's 0.0.5)
18+
1419
## Usage
1520

1621
This package supports both ESM and CommonJS formats.
@@ -96,7 +101,7 @@ Converts a JSON Schema object to a complete Zod schema.
96101

97102
- **Parameters**:
98103
- `schema` (Object): A JSON Schema object
99-
- **Returns**:
104+
- **Returns**:
100105
- A Zod schema that validates according to the JSON Schema
101106

102107
### `jsonSchemaObjectToZodRawShape(schema)`
@@ -105,7 +110,7 @@ Extracts the object properties from a JSON Schema object into a Zod raw shape. T
105110

106111
- **Parameters**:
107112
- `schema` (Object): A JSON Schema object that should have a `properties` field
108-
- **Returns**:
113+
- **Returns**:
109114
- A `ZodRawShape` object that can be used with `z.object()`
110115

111116
**Example**:

examples/cjs-example.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

examples/esm-example.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

examples/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6-
"cjs": "node cjs-example.js",
7-
"esm": "node esm-example.js"
6+
"cjs": "node cjs-example.cjs",
7+
"esm": "node esm-example.mjs"
88
},
99
"dependencies": {
10-
"zod": "^3.24.2",
10+
"zod": "^3.25.25",
1111
"zod-from-json-schema": "file:.."
1212
}
13-
}
13+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zod-from-json-schema",
3-
"version": "0.0.5",
3+
"version": "0.4.0",
44
"description": "Creates Zod types from JSON Schema at runtime",
55
"main": "dist/index.js",
66
"module": "dist/index.mjs",

0 commit comments

Comments
 (0)