Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs link #1133

Merged
merged 4 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<p align="center">
<img src="logo.svg" width="200px" align="center" alt="Zod logo" />
<h1 align="center">Zod</h1>
<p align="center">TypeScript-first schema validation with static type inference</p>
<p align="center">
<a href="https://zod.dev">✨ https://zod.dev ✨</a>
<br/>
TypeScript-first schema validation with static type inference
</p>
</p>
<br/>
<p align="center">
Expand All @@ -11,10 +15,11 @@
<a href="https://www.npmjs.com/package/zod" rel="nofollow"><img src="https://img.shields.io/npm/dw/zod.svg" alt="npm"></a>
<a href="https://www.npmjs.com/package/zod" rel="nofollow"><img src="https://img.shields.io/github/stars/colinhacks/zod" alt="stars"></a>
<a href="https://discord.gg/KaSRdyX2vc" rel="nofollow"><img src="https://img.shields.io/discord/893487829802418277?label=Discord&logo=discord&logoColor=white" alt="discord server"></a>
<!-- <a href="https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys" rel="nofollow"><img src="https://api.netlify.com/api/v1/badges/0c13c2f2-86de-4115-895d-d0a4cb36af1a/deploy-status" alt="netlify deploy status"></a> -->
</p>

<div align="center">
<a href="https://zod.dev">Documentation</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://discord.gg/RcG33DQJdf">Discord</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://www.npmjs.com/package/zod">NPM</a>
Expand All @@ -30,7 +35,7 @@
<br/>
<br/>

These docs have been translated into [Chinese](./README_ZH.md).
> These docs have been translated into [Chinese](./README_ZH.md).

## Table of contents

Expand Down
49 changes: 22 additions & 27 deletions README_ZH.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
<p align="center">
<img src="logo.svg" width="200px" align="center" />
<img src="logo.svg" width="200px" align="center" alt="Zod logo" />
<h1 align="center">Zod</h1>
<p align="center">TypeScript-first schema validation with static type inference
<br/>
<a href="https://zod.dev">https://zod.dev</a></p>
</p>
<br/>
<p align="center">
<a href="https://github.com/colinhacks/zod/actions?query=branch%3Amaster"><img src="https://github.com/colinhacks/zod/actions/workflows/test.yml/badge.svg?event=push&branch=master" alt="Zod CI status" /></a>
<a href="https://twitter.com/colinhacks" rel="nofollow"><img src="https://img.shields.io/badge/created%20by-@colinhacks-4BBAAB.svg" alt="Created by Colin McDonnell"></a>
<a href="https://opensource.org/licenses/MIT" rel="nofollow"><img src="https://img.shields.io/github/license/colinhacks/zod" alt="License"></a>
<a href="https://www.npmjs.com/package/zod" rel="nofollow"><img src="https://img.shields.io/npm/dw/zod.svg" alt="npm"></a>
<a href="https://www.npmjs.com/package/zod" rel="nofollow"><img src="https://img.shields.io/github/stars/colinhacks/zod" alt="stars"></a>
<a href="./src/__tests__" rel="nofollow"><img src="./coverage.svg" alt="coverage"></a>

</p>
<p align="center">
⭐️ smash that star button ⭐️
<a href="https://discord.gg/KaSRdyX2vc" rel="nofollow"><img src="https://img.shields.io/discord/893487829802418277?label=Discord&logo=discord&logoColor=white" alt="discord server"></a>
</p>

> 如果你喜欢 Zod,你会喜欢我的新库 [tRPC](https://trpc.io). 这是一种建立端到端类型安全 API 的方法,无需 GraphQL 或代码生成 请在[trpc.io](https://trpc.io)上查看他.
<div align="center">
<a href="https://zod.dev">Documentation</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://discord.gg/RcG33DQJdf">Discord</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://www.npmjs.com/package/zod">NPM</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://github.com/colinhacks/zod/issues/new">Issues</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://twitter.com/colinhacks">@colinhacks</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://trpc.io">tRPC</a>
<br />
</div>

<br/>

## 二零二一年五月十七日: Zod v3 已经进入稳定版!

查看 [迁移指南](https://github.com/colinhacks/zod/blob/master/MIGRATION.md) 进行升级.

以前的版本:

- [`Zod 1 docs`](https://github.com/colinhacks/zod/tree/v1)
- [`Zod 2 docs`](https://github.com/colinhacks/zod/tree/v2)

#### 新功能

- **更容易的引入**: 你现在可以像`import { z } from 'zod';`那样导入 Zod,而不是使用`import * as`语法。
- **结构化的错误消息**. 对 ZodError 使用`.format()`方法,将错误转换为强类型的嵌套对象: [format method](#error-formatting)
- **更容易的联合类型**. 使用 ZodType(所有 Zod 模式的基类)的`or`方法,可以轻松创建联合类型,如 `z.string().or(z.number())`
- **更容易的交叉类型**. 对 ZodType(所有 Zod 模式的基类)使用`and`方法,可以轻松创建交叉类型
- **全局错误定制**. 使用`z.setErrorMap(myErrorMap)`来全面定制 Zod 产生的错误信息: [setErrorMap](ERROR_HANDLING.md#customizing-errors-with-zoderrormap)
- **Maps and sets**. Zod 现在支持 [`Map`](#maps) 和 [`Set`](#sets) 模式。
- **可选的和可忽略的解包**. ZodOptional 和 ZodNullable 现在有一个`.unwrap()`方法来检索它们所包裹的模式。
- **A new implementation of transformers**. 请参阅[迁移指南](https://github.com/colinhacks/zod/blob/master/MIGRATION.md)部分以了解语法的变化。
<br/>

# 內容

Expand Down
16 changes: 14 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<meta property="og:type" content="object" />
<meta
property="og:title"
content="colinhacks/zod: TypeScript-first schema validation with static type inference"
content="TypeScript-first schema validation with static type inference"
/>
<meta property="og:url" content="https://github.com/colinhacks/zod" />
<meta
Expand Down Expand Up @@ -71,9 +71,21 @@
<meta name="msapplication-config" content="/static/browserconfig.xml" />
<meta name="theme-color" content="#ffffff" />
<link
rel="stylesheet"
href="//cdn.jsdelivr.net/npm/docsify-darklight-theme@latest/dist/style.min.css"
type="text/css"
rel="preload"
as="style"
onload="this.onload=null;this.rel='stylesheet';"
title="docsify-darklight-theme"
/>
<link
href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css"
type="text/css"
rel="preload"
as="style"
onload="this.onload=null;this.rel='stylesheet';"
/>

<style>
.markdown-section {
max-width: 700px;
Expand Down