-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13af7a3
commit 8976023
Showing
7 changed files
with
114 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -326,7 +326,6 @@ bun add zod # bun | |
pnpm add zod # pnpm | ||
``` | ||
|
||
|
||
> README 的剩余部分假定你是直接通过 npm 安装的`zod`包。 | ||
# 基本用法 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,8 +65,7 @@ | |
- [Utilities for Zod](#utilities-for-zod) | ||
- [Installation](#installation) | ||
- [Requirements](#requirements) | ||
- [From `npm` (Node/Bun)](#from-npm-nodebun) | ||
- [From `deno.land/x` (Deno)](#from-denolandx-deno) | ||
- [From `npm`](#from-npm) | ||
- [Basic usage](#basic-usage) | ||
- [Primitives](#primitives) | ||
- [Coercion for primitives](#coercion-for-primitives) | ||
|
@@ -81,7 +80,7 @@ | |
- [BigInts](#bigints) | ||
- [NaNs](#nans) | ||
- [Booleans](#booleans) | ||
- [Dates](#dates) | ||
- [Dates](#dates-1) | ||
- [Zod enums](#zod-enums) | ||
- [Native enums](#native-enums) | ||
- [Optionals](#optionals) | ||
|
@@ -493,6 +492,7 @@ There are a growing number of tools that are built atop or support Zod natively! | |
- [`tapiduck`](https://github.com/sumukhbarve/monoduck/blob/main/src/tapiduck/README.md): End-to-end typesafe JSON APIs with Zod and Express; a bit like tRPC, but simpler. | ||
- [`koa-zod-router`](https://github.com/JakeFenley/koa-zod-router): Create typesafe routes in Koa with I/O validation using Zod. | ||
- [`zod-sockets`](https://github.com/RobinTail/zod-sockets): Zod-powered Socket.IO microframework with I/O validation and built-in AsyncAPI specs | ||
- [`oas-tszod-gen`](https://github.com/inkognitro/oas-tszod-gen): Client SDK code generator to convert OpenApi v3 specifications into TS endpoint caller functions with Zod types. | ||
|
||
#### Form integrations | ||
|
||
|
@@ -511,6 +511,7 @@ There are a growing number of tools that are built atop or support Zod natively! | |
- [`mobx-zod-form`](https://github.com/MonoidDev/mobx-zod-form): Data-first form builder based on MobX & Zod. | ||
- [`@vee-validate/zod`](https://github.com/logaretm/vee-validate/tree/main/packages/zod): Form library for Vue.js with Zod schema validation. | ||
- [`zod-form-renderer`](https://github.com/thepeaklab/zod-form-renderer): Auto-infer form fields from zod schema and render them with react-hook-form with E2E type safety. | ||
- [`antd-zod`](https://github.com/MrBr/antd-zod): Zod adapter for Ant Design form fields validation. | ||
|
||
#### Zod to X | ||
|
||
|
@@ -593,10 +594,11 @@ There are a growing number of tools that are built atop or support Zod natively! | |
} | ||
``` | ||
|
||
### From `npm` (Node/Bun) | ||
### From `npm` | ||
|
||
```sh | ||
npm install zod # npm | ||
deno add npm:zod # deno | ||
yarn add zod # yarn | ||
bun add zod # bun | ||
pnpm add zod # pnpm | ||
|
@@ -606,25 +608,12 @@ Zod also publishes a canary version on every commit. To install the canary: | |
|
||
```sh | ||
npm install zod@canary # npm | ||
deno add npm:zod@canary # deno | ||
yarn add zod@canary # yarn | ||
bun add zod@canary # bun | ||
pnpm add zod@canary # pnpm | ||
``` | ||
|
||
### From `deno.land/x` (Deno) | ||
|
||
Unlike Node, Deno relies on direct URL imports instead of a package manager like NPM. Zod is available on [deno.land/x](https://deno.land/x). The latest version can be imported like so: | ||
|
||
```ts | ||
import { z } from "https://deno.land/x/zod/mod.ts"; | ||
``` | ||
|
||
You can also specify a particular version: | ||
|
||
```ts | ||
import { z } from "https://deno.land/x/[email protected]/mod.ts"; | ||
``` | ||
|
||
> The rest of this README assumes you are using npm and importing directly from the `"zod"` package. | ||
## Basic usage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters