a11y.skipToMainContent
1

JSON 到着地 ゾド・スキーマ

JSON を貼り付け、既定の <code>z.object({...})</code> を取得する Zodスキーマと、劣ったTypeScriptタイプ.

More options
Was this tool helpful?
Send output to:
Advertisement

How to use JSON to Zod Schema

  1. JSONオブジェクトを貼り付けます.
  2. スキーマ変数名を選択します.
  3. また、<code>z.infer<typeof schema></code> を取得するには、 "export type" を切り替えます.
  4. 結果を TypeScript プロジェクトに貼り付けます.

JSON から Zod Schemaとは?

Zod は、TypeScript エコシステムで最も人気のあるランタイム検証ライブラリです。 このツールは、JSON サンプルからマッチングスキーマを生成するため、ボイラープレートを書くことなく、API レスポンス、フォーム入力、または env vars を検証できます。 メール、URL、UUID、またはISOの日付時刻のように見える文字列は、自動的にZodメソッドのマッチングを取得します。

Advertisement

FAQ

どのフォーマットが検出されますか?
.email()/ .url()/ .uuid()/ .datetime() メソッドのマッチングを .email()/ .url()/ .uuid()/ .datetime() メソッドします.
Zodをインストールする必要がありますか?
はい。生成されたコードは標準<code>zod</code>パッケージを使用します。 <code>npm i zod</code> をインストールします.

Related tools

Author

MW
Marcus Webb"The DevTool Craftsman"

Full-Stack Developer & Tools Architect

Marcus has been writing code since the dial-up era. He has contributed to open-source developer tools, built CI/CD pipelines for startups, and debugged production incidents at 3 AM more times than he would like to admit. His philosophy is that the best developer tool is the one that gets out of your way, and he writes about practical tooling that helps teams ship faster with fewer headaches.

← Back to Developer Tools · All tags

Last updated:

Advertisement