1 line
44 KiB
JSON
1 line
44 KiB
JSON
{"success":true,"data":{"web":[{"url":"https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation","title":"Schema validation - FastMCP - Mintlify","description":"FastMCP uses the Standard Schema specification for defining tool parameters. This allows you to use your preferred schema validation library (Zod, ArkType, or ...","position":1,"markdown":"[Skip to main content](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation#content-area)\n\nGenerated[Mar 3, 2026](https://github.com/punkpeye/fastmcp/commit/12524581c777ccfd9d72d00b7230838f0af3800d)by\\| [Use as starter template](https://dashboard.mintlify.com/atlas/clone?atlas_deployment_id=69a681aa8cbcc042c26a2cac&utm_medium=atlas_referral)\n\n[FastMCP home page\\\\\nFastMCP](https://www.mintlify.com/punkpeye/fastmcp)\n\nSearch...\n\nCtrl KAsk AI\n\nSearch...\n\nNavigation\n\nGuides\n\nSchema validation\n\n[Documentation](https://www.mintlify.com/punkpeye/fastmcp) [API Reference](https://www.mintlify.com/punkpeye/fastmcp/api/fastmcp) [CLI](https://www.mintlify.com/punkpeye/fastmcp/cli/overview)\n\n##### Get Started\n\n- [FastMCP Documentation](https://www.mintlify.com/punkpeye/fastmcp)\n- [Installation](https://www.mintlify.com/punkpeye/fastmcp/installation)\n- [Quickstart](https://www.mintlify.com/punkpeye/fastmcp/quickstart)\n\n##### Core Concepts\n\n- [Tools](https://www.mintlify.com/punkpeye/fastmcp/core/tools)\n- [Resources](https://www.mintlify.com/punkpeye/fastmcp/core/resources)\n- [Prompts](https://www.mintlify.com/punkpeye/fastmcp/core/prompts)\n- [Sessions](https://www.mintlify.com/punkpeye/fastmcp/core/sessions)\n- [Transports](https://www.mintlify.com/punkpeye/fastmcp/core/transports)\n\n##### Features\n\n- [Authentication](https://www.mintlify.com/punkpeye/fastmcp/features/authentication)\n- [OAuth Proxy](https://www.mintlify.com/punkpeye/fastmcp/features/oauth-proxy)\n- [Custom Routes](https://www.mintlify.com/punkpeye/fastmcp/features/custom-routes)\n- [Edge Runtime](https://www.mintlify.com/punkpeye/fastmcp/features/edge-runtime)\n- [Streaming & Progress](https://www.mintlify.com/punkpeye/fastmcp/features/streaming)\n- [Logging](https://www.mintlify.com/punkpeye/fastmcp/features/logging)\n\n##### Guides\n\n- [Schema validation](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation)\n- [Error handling](https://www.mintlify.com/punkpeye/fastmcp/guides/error-handling)\n- [Progress notifications](https://www.mintlify.com/punkpeye/fastmcp/guides/progress-notifications)\n- [Embedded resources](https://www.mintlify.com/punkpeye/fastmcp/guides/embedded-resources)\n- [Stateless mode](https://www.mintlify.com/punkpeye/fastmcp/guides/stateless-mode)\n- [HTTPS setup](https://www.mintlify.com/punkpeye/fastmcp/guides/https-setup)\n\n##### Deployment\n\n- [Cloudflare Workers Deployment](https://www.mintlify.com/punkpeye/fastmcp/deployment/cloudflare-workers)\n- [Serverless Deployments](https://www.mintlify.com/punkpeye/fastmcp/deployment/serverless)\n- [Production Checklist](https://www.mintlify.com/punkpeye/fastmcp/deployment/production)\n\nOn this page\n\n- [Supported libraries](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation#supported-libraries)\n- [Using Zod](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation#using-zod)\n- [Using ArkType](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation#using-arktype)\n- [Using Valibot](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation#using-valibot)\n- [Tools without parameters](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation#tools-without-parameters)\n- [Type inference](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation#type-inference)\n- [Complex schemas](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation#complex-schemas)\n- [Validation errors](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation#validation-errors)\n- [Next steps](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation#next-steps)\n\nFastMCP uses the [Standard Schema](https://standardschema.dev/) specification for defining tool parameters. This allows you to use your preferred schema validation library (Zod, ArkType, or Valibot) as long as it implements the spec.\n\n## [](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation\\#supported-libraries) Supported libraries\n\nFastMCP supports any validation library that implements the Standard Schema specification:\n\n[**Zod** \\\\\n\\\\\nMost popular TypeScript-first schema validation](https://zod.dev/)\n\n[**ArkType** \\\\\n\\\\\nTypeScript’s 1:1 validator](https://arktype.io/)\n\n[**Valibot** \\\\\n\\\\\nModular and type-safe schema library](https://valibot.dev/)\n\n## [](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation\\#using-zod) Using Zod\n\nZod is the most popular choice and comes with excellent TypeScript support:\n\n```\nimport { FastMCP } from \"fastmcp\";\nimport { z } from \"zod\";\n\nconst server = new FastMCP({\n name: \"My Server\",\n version: \"1.0.0\",\n});\n\nserver.addTool({\n name: \"fetch-content\",\n description: \"Fetch the content of a URL\",\n parameters: z.object({\n url: z.string().url(),\n timeout: z.number().optional().default(5000),\n headers: z.record(z.string()).optional(),\n }),\n execute: async (args) => {\n // args is fully typed: { url: string; timeout: number; headers?: Record<string, string> }\n return `Fetching ${args.url} with timeout ${args.timeout}ms`;\n },\n});\n```\n\n## [](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation\\#using-arktype) Using ArkType\n\nArkType provides 1:1 TypeScript syntax for runtime validation:\n\n```\nimport { FastMCP } from \"fastmcp\";\nimport { type } from \"arktype\";\n\nconst server = new FastMCP({\n name: \"My Server\",\n version: \"1.0.0\",\n});\n\nserver.addTool({\n name: \"fetch-content\",\n description: \"Fetch the content of a URL\",\n parameters: type({\n url: \"string\",\n \"timeout?\": \"number\",\n \"headers?\": \"Record<string, string>\",\n }),\n execute: async (args) => {\n return `Fetching ${args.url}`;\n },\n});\n```\n\n## [](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation\\#using-valibot) Using Valibot\n\nValibot is a modular, lightweight alternative with a functional API:\n\nValibot requires the peer dependency `@valibot/to-json-schema`.\n\n```\nnpm install valibot @valibot/to-json-schema\n```\n\n```\nimport { FastMCP } from \"fastmcp\";\nimport * as v from \"valibot\";\n\nconst server = new FastMCP({\n name: \"My Server\",\n version: \"1.0.0\",\n});\n\nserver.addTool({\n name: \"fetch-content\",\n description: \"Fetch the content of a URL\",\n parameters: v.object({\n url: v.string(),\n timeout: v.optional(v.number()),\n headers: v.optional(v.record(v.string(), v.string())),\n }),\n execute: async (args) => {\n return `Fetching ${args.url}`;\n },\n});\n```\n\n## [](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation\\#tools-without-parameters) Tools without parameters\n\nWhen creating tools that don’t require parameters, you have two options:\n\n- Omit parameters\n\n- Empty object\n\n\n```\nserver.addTool({\n name: \"sayHello\",\n description: \"Say hello\",\n // No parameters property\n execute: async () => {\n return \"Hello, world!\";\n },\n});\n```\n\n```\nimport { z } from \"zod\";\n\nserver.addTool({\n name: \"sayHello\",\n description: \"Say hello\",\n parameters: z.object({}), // Empty object\n execute: async () => {\n return \"Hello, world!\";\n },\n});\n```\n\nBoth approaches are fully compatible with all MCP clients, including Cursor. FastMCP automatically generates the proper schema in both cases.\n\n## [](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation\\#type-inference) Type inference\n\nAll schema libraries provide automatic TypeScript type inference for the `execute` function:\n\n```\nimport { z } from \"zod\";\n\nconst UserSchema = z.object({\n name: z.string(),\n age: z.number(),\n email: z.string().email(),\n});\n\nserver.addTool({\n name: \"createUser\",\n description: \"Create a new user\",\n parameters: UserSchema,\n execute: async (args) => {\n // args is typed as: { name: string; age: number; email: string }\n return `Created user: ${args.name} (${args.email}), age ${args.age}`;\n },\n});\n```\n\n## [](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation\\#complex-schemas) Complex schemas\n\nYou can use all features of your chosen schema library:\n\n```\nimport { z } from \"zod\";\n\nserver.addTool({\n name: \"processData\",\n description: \"Process complex data\",\n parameters: z.object({\n // Enums\n status: z.enum([\"pending\", \"active\", \"completed\"]),\n\n // Arrays\n tags: z.array(z.string()).min(1).max(10),\n\n // Nested objects\n metadata: z.object({\n createdBy: z.string(),\n timestamp: z.number(),\n }),\n\n // Union types\n value: z.union([z.string(), z.number()]),\n\n // Optional with default\n priority: z.number().min(1).max(5).default(3),\n }),\n execute: async (args) => {\n return `Processing with status: ${args.status}`;\n },\n});\n```\n\n## [](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation\\#validation-errors) Validation errors\n\nWhen a client passes invalid parameters, FastMCP automatically handles validation errors and returns them to the client:\n\n```\nimport { z } from \"zod\";\n\nserver.addTool({\n name: \"validateEmail\",\n description: \"Validate an email address\",\n parameters: z.object({\n email: z.string().email(\"Invalid email format\"),\n }),\n execute: async (args) => {\n return `Valid email: ${args.email}`;\n },\n});\n\n// If client passes { email: \"not-an-email\" }, they receive:\n// Error: Invalid email format\n```\n\n## [](https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation\\#next-steps) Next steps\n\n[**Tools** \\\\\n\\\\\nLearn more about tool definitions](https://www.mintlify.com/punkpeye/fastmcp/core/tools)\n\n[**Error Handling** \\\\\n\\\\\nHandle errors in your tools](https://www.mintlify.com/punkpeye/fastmcp/guides/error-handling)\n\n[Logging\\\\\n\\\\\nPrevious](https://www.mintlify.com/punkpeye/fastmcp/features/logging) [Error handling\\\\\n\\\\\nNext](https://www.mintlify.com/punkpeye/fastmcp/guides/error-handling)\n\nCtrl+I\n\nAssistant\n\nResponses are generated using AI and may contain mistakes.","metadata":{"language":"en","description":"Use Zod, Valibot, or ArkType for type-safe tool parameters with Standard Schema support","og:site_name":"FastMCP","ogTitle":"Schema validation - FastMCP","twitter:card":"summary_large_image","og:image:width":"1200","msapplication-config":"https://mintlify.s3.us-west-1.amazonaws.com/punkpeye-fastmcp/_generated/favicon/browserconfig.xml?v=3","next-size-adjust":"","msapplication-TileColor":"#5B7FFF","og:url":"https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation","twitter:title":"Schema validation - FastMCP","twitter:image":"https://punkpeye-fastmcp.mintlify.app/mintlify-assets/_next/image?url=%2F_mintlify%2Fapi%2Fog%3Fdivision%3DGuides%26title%3DSchema%2Bvalidation%26description%3DUse%2BZod%252C%2BValibot%252C%2Bor%2BArkType%2Bfor%2Btype-safe%2Btool%2Bparameters%2Bwith%2BStandard%2BSchema%2Bsupport%26primaryColor%3D%25235B7FFF%26lightColor%3D%25237B9AFF%26darkColor%3D%25234A66CC%26backgroundLight%3D%2523ffffff%26backgroundDark%3D%25230b0c10&w=1200&q=100","og:title":"Schema validation - FastMCP","twitter:image:width":"1200","og:image":"https://punkpeye-fastmcp.mintlify.app/mintlify-assets/_next/image?url=%2F_mintlify%2Fapi%2Fog%3Fdivision%3DGuides%26title%3DSchema%2Bvalidation%26description%3DUse%2BZod%252C%2BValibot%252C%2Bor%2BArkType%2Bfor%2Btype-safe%2Btool%2Bparameters%2Bwith%2BStandard%2BSchema%2Bsupport%26primaryColor%3D%25235B7FFF%26lightColor%3D%25237B9AFF%26darkColor%3D%25234A66CC%26backgroundLight%3D%2523ffffff%26backgroundDark%3D%25230b0c10&w=1200&q=100","og:image:height":"630","title":"Schema validation - FastMCP","ogDescription":"Use Zod, Valibot, or ArkType for type-safe tool parameters with Standard Schema support","twitter:description":"Use Zod, Valibot, or ArkType for type-safe tool parameters with Standard Schema support","canonical":"https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation","twitter:image:height":"630","ogUrl":"https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation","apple-mobile-web-app-title":"FastMCP","og:description":"Use Zod, Valibot, or ArkType for type-safe tool parameters with Standard Schema support","application-name":"FastMCP","viewport":"width=device-width, initial-scale=1, viewport-fit=cover","generator":"Mintlify","og:type":"website","ogImage":"https://punkpeye-fastmcp.mintlify.app/mintlify-assets/_next/image?url=%2F_mintlify%2Fapi%2Fog%3Fdivision%3DGuides%26title%3DSchema%2Bvalidation%26description%3DUse%2BZod%252C%2BValibot%252C%2Bor%2BArkType%2Bfor%2Btype-safe%2Btool%2Bparameters%2Bwith%2BStandard%2BSchema%2Bsupport%26primaryColor%3D%25235B7FFF%26lightColor%3D%25237B9AFF%26darkColor%3D%25234A66CC%26backgroundLight%3D%2523ffffff%26backgroundDark%3D%25230b0c10&w=1200&q=100","charset":"utf-8","favicon":"https://mintlify.s3.us-west-1.amazonaws.com/punkpeye-fastmcp/_generated/favicon/favicon-32x32.png?v=3","scrapeId":"019d3957-e1ab-75ba-9af9-c652a19009da","sourceURL":"https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation","url":"https://www.mintlify.com/punkpeye/fastmcp/guides/schema-validation","statusCode":200,"contentType":"text/html; charset=utf-8","proxyUsed":"basic","cacheState":"hit","cachedAt":"2026-03-29T11:21:21.230Z","creditsUsed":1}},{"url":"https://github.com/sinclairzx81/typebox/discussions/1152","title":"Implement Standard Schema interface · sinclairzx81 typebox - GitHub","description":"TypeMap only supports Zod and Valibot as their runtime structures were mappable. An attempt was made to support ArkType but wasn't feasible as ...","position":2,"category":"github","markdown":"[Skip to content](https://github.com/sinclairzx81/typebox/discussions/1152#start-of-content)\n\nYou signed in with another tab or window. [Reload](https://github.com/sinclairzx81/typebox/discussions/1152) to refresh your session.You signed out in another tab or window. [Reload](https://github.com/sinclairzx81/typebox/discussions/1152) to refresh your session.You switched accounts on another tab or window. [Reload](https://github.com/sinclairzx81/typebox/discussions/1152) to refresh your session.Dismiss alert\n\n{{ message }}\n\n[sinclairzx81](https://github.com/sinclairzx81)/ **[typebox](https://github.com/sinclairzx81/typebox)** Public\n\n- [Notifications](https://github.com/login?return_to=%2Fsinclairzx81%2Ftypebox) You must be signed in to change notification settings\n- [Fork\\\\\n197](https://github.com/login?return_to=%2Fsinclairzx81%2Ftypebox)\n- [Star\\\\\n6.6k](https://github.com/login?return_to=%2Fsinclairzx81%2Ftypebox)\n\n\n# Implement Standard Schema interface \\#1152\n\n[marcomuser](https://github.com/marcomuser)\n\nstarted this conversation in\n[General](https://github.com/sinclairzx81/typebox/discussions/categories/general)\n\n[Implement Standard Schema interface](https://github.com/sinclairzx81/typebox/discussions/1152#top)#1152\n\n[\\\\\nmarcomuser](https://github.com/marcomuser)\n\non Dec 29, 2024Dec 29, 2024·\n6 comments\n·\n3 replies\n\n\n[Return to top](https://github.com/sinclairzx81/typebox/discussions/1152#top)\n\nDiscussion options\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{title}}\n\nQuote reply\n\nedited\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{editor}}'s edit\n\n{{actor}} deleted this content\n.\n\n# {{editor}}'s edit\n\n## [\\ marcomuser](https://github.com/marcomuser) [on Dec 29, 2024Dec 29, 2024](https://github.com/sinclairzx81/typebox/discussions/1152\\#discussion-7900320)\n\nOriginal comment in English -\nTranslate to English\n\n| |\n| --- |\n| Have you already considered implementing the standard schema interface: [https://github.com/standard-schema/standard-schema](https://github.com/standard-schema/standard-schema). This would provide third-party libraries a uniform integration to automatically support multiple schema libraries at once. Currently, zod, valibot and arktype implement the interface. I'm working on a library integrating with schema libs and I would love to also integrate with typebox without writing a custom adapter. |\n\nBetaWas this translation helpful? [Give feedback.](https://github.com/sinclairzx81/typebox/discussions/1152#)\n\n4You must be logged in to vote\n\n7\n\nAll reactions\n\n- 7\n\n## Replies: 6 comments · 3 replies\n\nComment options\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{title}}\n\nQuote reply\n\nedited\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{editor}}'s edit\n\n{{actor}} deleted this content\n.\n\n# {{editor}}'s edit\n\n### [\\ sinclairzx81](https://github.com/sinclairzx81) [on Jan 2, 2025Jan 2, 2025](https://github.com/sinclairzx81/typebox/discussions/1152\\#discussioncomment-12025404) Maintainer\n\nOriginal comment in English -\nTranslate to English\n\n| |\n| --- |\n| [@marcomuser](https://github.com/marcomuser) Hi, thanks for the suggestion.<br>There is a provisional Adapter to Standard Schema being developed and documented at the following URL<br>[https://github.com/sinclairzx81/typebox/tree/master/example/standard](https://github.com/sinclairzx81/typebox/tree/master/example/standard)<br>I have a lot to say about Standard Schema, will outline my thoughts on it below.<br>* * *<br>### Standard Schema (Review)<br>Unfortunately, I won't be able to implement the Standard Schema interface on TypeBox types because doing so would require TypeBox to include non-standard keyword vocabulary, such as `~standard` on schematics, as well as require it to augment schematics with TypeBox specific validation functions (which wouldn't make sense for users who use TypeBox solely with Ajv)<br>Overall, I am not very keen on the design of Standard Schema, not only for the reasons mentioned above, but primarily because the specification would rule out any library that separates schematics from validation. This is a principled design decision that libraries make (i.e. adhering to separation of concerns) and unfortunately Standard Schema would require such libraries to violate these principles.<br>```<br>const result = schema['~standard'].validate(value) // Incorrect: Because schemas should not have <br> // functions and should not validate themselves. <br>const result = validate(schema, value) // Correct: Schemas are parameters to validators<br>```<br>While the former is possible in Zod, Valibot and Ark (which do carry validation around on their types), it's not feasible for TypeBox as it only builds Json Schema, and where those schematics are intended to be passed to any Json Schema compliant validator.<br>```<br>const result = (new Ajv()).validate({ type: 'string' }, value) <br>// ^<br>// |<br>// Optional: Replace with Type.String()<br>```<br>These are the main concerns I have with the specification (Jan 2025)<br>* * *<br>### More Issues<br>Beyond the above concerns, I have several additional issues with the specification:<br>- The naming is misleading, as API interfaces have nothing to do with schematics (unless the intent is to conflate these terms).<br>- The return type for `validate` suggests a `parse` operation. Additionally, the returned value requires initialization for each validation call, hindering optimization. The specification should consider separating `parse` and `validate` into distinct API calls.<br>- Validation errors should be accessible via a separate API call rather than always being generated. Validation errors are diagnostics that incur a processing cost and may not be necessary in all environments. A system may prefer a boolean result instead of detailed diagnostics under the \"minimal-disclosure\" or \"give no hints\" principle.<br>- Validation errors currently expand all errors into potentially large objects, with no DoS mitigation mechanism for types that may generate large error sets. An error function that returns an iterator may address this issue (but do think a larger discussion should be had around error generation)<br>- The async return for validation does not make sense and should be removed.<br>- The specification makes no provisions for JIT (Just-In-Time) evaluation.<br>* * *<br>### Adapter<br>Needless to say, with all of the above, it isn't reasonable for TypeBox to break compatibility with a already widely adopted industry standard specification (Json Schema) just to unify with a few popular JavaScript validation libraries.<br>Irrespective of the ergonomics or perceived DX wins integrators are expected to get (which I expect was largely used to inform the specification design), I really don't consider Standard Schema to be forward looking enough in terms of overall design, or representative of the myriad of other ways integrators can approach uniform type library adoption in frameworks.<br>As such, an Adapter will be required.<br>```<br>import { StandardSchema } from './standard' // is it really standard?<br>const T = StandardSchema(Type.Object({ // Breaks Json Schema compliance by augmenting<br> x: Type.Number(), // a TypeBox schematic with functions and keywords<br> y: Type.Number(), // required by the Standard Schema interface.<br> z: Type.Number(),<br>}))<br>```<br>* * *<br>### Alternatives<br>If you are looking for an alternative to Standard Schema, I would recommend the following projects (which are supportive of a wider range of type libraries and validators)<br>Current Gold Standard<br>[https://github.com/decs/typeschema](https://github.com/decs/typeschema)<br>Something I am working on which is a generalization of Fastify Type Providers<br>[https://github.com/sinclairzx81/type-adapters](https://github.com/sinclairzx81/type-adapters)<br>Something else I am exploring<br>[https://github.com/sinclairzx81/typebox-adapter](https://github.com/sinclairzx81/typebox-adapter)<br>* * *<br>Hope this brings some insight into where TypeBox is at with regards to Standard Schema. Happy to discuss more on this thread if you have any questions though.<br>I have been asked to comment on the Standard Schema repository. Unfortunately, it is very difficult for me to communicate aspects of the specification without me suggesting that the authors adopt a design that runs contrary to how their libraries are written. I do note that the specification is written in service to frameworks such as tRPC where the specification does a better job of integration than previously, but falls short of servicing frameworks that are built upon industry specifications like Json Schema.<br>There is a lot to discuss, but too broader context in which to discuss it. But hopefully the above communicates my thoughts around it.<br>Cheers<br>S |\n\nBetaWas this translation helpful? [Give feedback.](https://github.com/sinclairzx81/typebox/discussions/1152#)\n\n3You must be logged in to vote\n\n14\n\nAll reactions\n\n- 14\n\n0 replies\n\n\nComment options\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{title}}\n\nQuote reply\n\n### [\\ marcomuser](https://github.com/marcomuser) [on Jan 3, 2025Jan 3, 2025](https://github.com/sinclairzx81/typebox/discussions/1152\\#discussioncomment-12025405) Author\n\nOriginal comment in English -\nTranslate to English\n\n| |\n| --- |\n| Thank you very much for providing such a detailed response. What you're saying makes sense to me! I wasn't aware of the implications for json schema tooling compatibility.<br>Since you're not planning to implement it, would it make sense to convert this issue to a discussion (instead of closing it) so that your arguments are somewhat documented? I have a feeling that this will not be the last time that someone will wonder how simple it would be for typebox to implement the interface. |\n\nBetaWas this translation helpful? [Give feedback.](https://github.com/sinclairzx81/typebox/discussions/1152#)\n\n2You must be logged in to vote\n\n1\n\nAll reactions\n\n- 1\n\n0 replies\n\n\nComment options\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{title}}\n\nQuote reply\n\nedited\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{editor}}'s edit\n\n{{actor}} deleted this content\n.\n\n# {{editor}}'s edit\n\n### [\\ sinclairzx81](https://github.com/sinclairzx81) [on Jan 16, 2025Jan 16, 2025](https://github.com/sinclairzx81/typebox/discussions/1152\\#discussioncomment-12025406) Maintainer\n\nOriginal comment in English -\nTranslate to English\n\n| |\n| --- |\n| [@marcomuser](https://github.com/marcomuser) Hi, sorry for the delay in response (busy start to the year)<br>> Since you're not planning to implement it, would it make sense to convert this issue to a discussion (instead of closing it) so that your arguments are somewhat documented?<br>Ah, will keep this issue open for a while. Keeping it as an issue helps to make it a bit more visible as well as reminding me to keep an eye on the updates to the spec.<br>As mentioned though, bar substantial changes to the specification to split validation from schematics, an adapter to Standard Schema is going to be the way to go. The current plan is to continue to revise the [reference implementation](https://github.com/sinclairzx81/typebox/tree/master/example/standard) based on updated spec info, but I may ultimately end up publishing the formal implementation to the following project.<br>[https://github.com/sinclairzx81/typemap](https://github.com/sinclairzx81/typemap)<br>```<br>import { StandardSchema } from '@sinclair/typemap'<br>const T = StandardSchema(Type.String())<br>```<br>Will keep you posted on any changes / updates.<br>Cheers<br>S |\n\nBetaWas this translation helpful? [Give feedback.](https://github.com/sinclairzx81/typebox/discussions/1152#)\n\n1You must be logged in to vote\n\n4\n\nAll reactions\n\n- 4\n\n0 replies\n\n\nComment options\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{title}}\n\nQuote reply\n\nedited\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{editor}}'s edit\n\n{{actor}} deleted this content\n.\n\n# {{editor}}'s edit\n\n### [\\ sinclairzx81](https://github.com/sinclairzx81) [on Jan 25, 2025Jan 25, 2025](https://github.com/sinclairzx81/typebox/discussions/1152\\#discussioncomment-12025407) Maintainer\n\nOriginal comment in English -\nTranslate to English\n\n| |\n| --- |\n| [@marcomuser](https://github.com/marcomuser) Hi, quick update<br>I have started work on a new project called TypeMap. This project offers advanced translation between libraries and supports Standard Schema by way of projects `Compile` function. This function makes supported libraries compatible with Standard Schema and also offers accelerated type checking by allowing remote libraries to run on TypeBox infrastructure.<br>### Project<br>[TypeMap Project](https://github.com/sinclairzx81/typemap)<br>### Example<br>[Reference](https://www.typescriptlang.org/play/?moduleResolution=99&module=199#code/JYWwDg9gTgLgBAbzgZQJ4DsYEMAeAaOAFVTAFMAhCfOAYQnGABtS4BfOAMynrgHIABAM7B0AY0ZZgUAPQwSpEFjC8AUCtCRYcAF6duIPtogATVStER0g+AC04AXh0A6CACMAVqVEwAFEjgBgXDS0nAWVrYAXM42JgDyHl4wADwIKgE40dpO6ACuIK6kUD4AlARBFQEhFZkxJgBy+YVQANzpcKhZOU1FpeWVQdVBnXXGjQVFbQHaXXkTxSUDlUOBM6PjzW2si0u7S9WsBE7HAHxq5pbWKA4oGNg4PjY7A9XhV8jRAERItXPNBCM-kUCGsgVA2J9zm94IQbsQyJQHshnhVXpcYdFCAlPN5Uu09gTUaEMpiNpN8YTKSsRoQya0KZSCSs1rSevTGYyDmc1NDaDc6AxmD5CCUANq8AB+1iw6GMWCgpgAuk4AG5YRjAOUwUg+XjHJy8RZoiK0aLIbCy+XGZCiAAWCiwADUAIxOABKpEEuUYKTSHP9AaqxLgvzZU0DEcJ1OiYPDkfjL2DoLDDITaa5QA)<br> |\n\nBetaWas this translation helpful? [Give feedback.](https://github.com/sinclairzx81/typebox/discussions/1152#)\n\n2You must be logged in to vote\n\n33\n\nAll reactions\n\n- 3\n- 3\n\n0 replies\n\n\nComment options\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{title}}\n\nQuote reply\n\nedited\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{editor}}'s edit\n\n{{actor}} deleted this content\n.\n\n# {{editor}}'s edit\n\n### [\\ sinclairzx81](https://github.com/sinclairzx81) [on Feb 1, 2025Feb 1, 2025](https://github.com/sinclairzx81/typebox/discussions/1152\\#discussioncomment-12025408) Maintainer\n\nOriginal comment in English -\nTranslate to English\n\n| |\n| --- |\n| [@marcomuser](https://github.com/marcomuser) Hiya,<br>I might convert this issue into a discussion as TypeMap has been formally published as well as added to the Standard Schema [supported library](https://standardschema.dev/) list. TypeMap will be the primary way of integrating TypeBox with Standard Schema moving forward, as well as serve as a vehicle for innovation in the type inference / mapping space.<br>### Project<br>[TypeMap Project](https://github.com/sinclairzx81/typemap)<br>* * *<br>Happy to keep the conversation going, feel free to reach out if you have anything thoughts or suggestions on the design.<br>Cheers<br>S |\n\nBetaWas this translation helpful? [Give feedback.](https://github.com/sinclairzx81/typebox/discussions/1152#)\n\n1You must be logged in to vote\n\n12\n\nAll reactions\n\n- 1\n- 2\n\n1 reply\n\n\n[](https://github.com/marcomuser)\n\nComment options\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{title}}\n\nQuote reply\n\n#### [marcomuser](https://github.com/marcomuser) [on Feb 1, 2025Feb 1, 2025](https://github.com/sinclairzx81/typebox/discussions/1152\\#discussioncomment-12026045) Author\n\nOriginal comment in English -\nTranslate to English\n\n| |\n| --- |\n| Perfect! This looks awesome. Thank you for your effort!! |\n\nBetaWas this translation helpful? [Give feedback.](https://github.com/sinclairzx81/typebox/discussions/1152#)\n\n1\n\nAll reactions\n\n- 1\n\nComment options\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{title}}\n\nQuote reply\n\n### [\\ martiinii](https://github.com/martiinii) [on Apr 12, 2025Apr 12, 2025](https://github.com/sinclairzx81/typebox/discussions/1152\\#discussioncomment-12815703)\n\nOriginal comment in English -\nTranslate to English\n\n| |\n| --- |\n| Hey! I'm trying to switch from TypeBox to ArkType (ctx: Elysia.js, trying to keep my schemas in separate package, monorepo setup). The issue with Elysia is, it relies heavily on TypeBox. I've been trying to convert ArkType into TypeBox, however `Syntax` always returns `never`. ArkType already support standard schema, what could be the issue?<br>```<br>const myType = type({<br> x: \"number\"<br>})<br>const S = Syntax(myType) // \"never\"<br>const T = TypeBox(S)<br>``` |\n\nBetaWas this translation helpful? [Give feedback.](https://github.com/sinclairzx81/typebox/discussions/1152#)\n\n1You must be logged in to vote\n\nAll reactions\n\n2 replies\n\n\n[](https://github.com/sinclairzx81)\n\nComment options\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{title}}\n\nQuote reply\n\n#### [sinclairzx81](https://github.com/sinclairzx81) [on Apr 12, 2025Apr 13, 2025](https://github.com/sinclairzx81/typebox/discussions/1152\\#discussioncomment-12816240) Maintainer\n\nOriginal comment in English -\nTranslate to English\n\n| |\n| --- |\n| [@martiinii](https://github.com/martiinii) Hi,<br>> ArkType already support standard schema, what could be the issue?<br>TypeMap only supports Zod and Valibot as their runtime structures were mappable. An attempt was made to support ArkType but wasn't feasible as it's runtime representations were opaque (and thus not mappable). Refer to the link below for more information.<br>[standard-schema/standard-schema#35 (comment)](https://github.com/standard-schema/standard-schema/pull/35#issuecomment-2614523789)<br>Keep in mind, TypeMap does not map from Standard Schema because Standard Schema is NOT a schema, it is a TS interface with a `validate()` function that contains no runtime information (and thus is non-portable/mappable). Unfortunately the naming of Standard Schema is going to mislead a lot of developers.<br>* * *<br>> The issue with Elysia is, it relies heavily on TypeBox<br>I don't consider this to be an issue. TypeBox is best in class, however there is work being done to enable Elysia (and other frameworks) to support a wider range of libraries (including ArkType) by implementing extensions to TypeBox's validation infrastructure. This work should be ready later 2025. |\n\nBetaWas this translation helpful? [Give feedback.](https://github.com/sinclairzx81/typebox/discussions/1152#)\n\nAll reactions\n\n[](https://github.com/martiinii)\n\nComment options\n\n### Uh oh!\n\nThere was an error while loading. [Please reload this page](https://github.com/sinclairzx81/typebox/discussions/1152).\n\n# {{title}}\n\nQuote reply\n\n#### [martiinii](https://github.com/martiinii) [on Apr 13, 2025Apr 13, 2025](https://github.com/sinclairzx81/typebox/discussions/1152\\#discussioncomment-12817724)\n\nOriginal comment in English -\nTranslate to English\n\n| |\n| --- |\n| Thank you for detailed answer! Yeah, the standard schema naming is confusing. I don't mean to hate on Elysia or TypeBox - both are amazing, but I thought Elysia already supports standard schema - guess I'll be patient |\n\nBetaWas this translation helpful? [Give feedback.](https://github.com/sinclairzx81/typebox/discussions/1152#)\n\nAll reactions\n\n[Sign up for free](https://github.com/join?source=comment-repo) **to join this conversation on GitHub**.\nAlready have an account?\n[Sign in to comment](https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsinclairzx81%2Ftypebox%2Fdiscussions%2F1152)\n\nCategory\n\n\n[\\\\\n\\\\\nGeneral](https://github.com/sinclairzx81/typebox/discussions/categories/general)\n\nLabels\n\n\n[review](https://github.com/sinclairzx81/typebox/discussions?discussions_q=label%3Areview) [discussion](https://github.com/sinclairzx81/typebox/discussions?discussions_q=label%3Adiscussion)\n\n3 participants\n\n\n[](https://github.com/marcomuser)[](https://github.com/sinclairzx81)[](https://github.com/martiinii)\n\nConverted from issue\n\n\nThis discussion was converted from issue [#1127](https://github.com/sinclairzx81/typebox/issues/1127) on February 01, 2025 11:25.\n\n\nHeading\n\nBold\n\nItalic\n\nQuote\n\nCode\n\nLink\n\n* * *\n\nNumbered list\n\nUnordered list\n\nTask list\n\n* * *\n\nAttach files\n\nMention\n\nReference\n\n# Select a reply\n\nLoading\n\n[Create a new saved reply](https://github.com/sinclairzx81/typebox/discussions/1152)\n\n👍1 reacted with thumbs up emoji👎1 reacted with thumbs down emoji😄1 reacted with laugh emoji🎉1 reacted with hooray emoji😕1 reacted with confused emoji❤️1 reacted with heart emoji🚀1 reacted with rocket emoji👀1 reacted with eyes emoji\n\nYou can’t perform that action at this time.","metadata":{"octolytics-dimension-repository_id":"87454905","hostname":"github.com","ogImage":"https://opengraph.githubassets.com/f96ad6f349e74b0ec36d462f2d1c7ed71d35baeccd31a9739411cc187ec17324/sinclairzx81/typebox/discussions/1152","og:site_name":"GitHub","browser-stats-url":"https://api.github.com/_private/browser/stats","release":"51d2e33e3d1e4839c3ced5f8e35c7a47d3a60f32","octolytics-dimension-user_login":"sinclairzx81","octolytics-dimension-repository_public":"true","fb:app_id":"1401488693436528","go-import":"github.com/sinclairzx81/typebox git https://github.com/sinclairzx81/typebox.git","og:url":"https://github.com/sinclairzx81/typebox/discussions/1152","browser-errors-url":"https://api.github.com/_private/browser/errors","octolytics-dimension-repository_nwo":"sinclairzx81/typebox","twitter:card":"summary_large_image","og:title":"Implement Standard Schema interface · sinclairzx81/typebox · Discussion #1152","theme-color":"#1e2327","fetch-nonce":"v2:4e51d092-0f8c-de56-2e9c-af85cf1a6df2","viewport":"width=device-width","route-pattern":"/_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format)","github-keyboard-shortcuts":"repository,copilot","title":"Implement Standard Schema interface · sinclairzx81/typebox · Discussion #1152 · GitHub","og:image":"https://opengraph.githubassets.com/f96ad6f349e74b0ec36d462f2d1c7ed71d35baeccd31a9739411cc187ec17324/sinclairzx81/typebox/discussions/1152","twitter:site":"@github","twitter:description":"Have you already considered implementing the standard schema interface: https://github.com/standard-schema/standard-schema. This would provide third-party libraries a uniform integration to automat...","og:type":"object","ogDescription":"Have you already considered implementing the standard schema interface: https://github.com/standard-schema/standard-schema. This would provide third-party libraries a uniform integration to automat...","route-action":"discussion_layout","google-site-verification":"Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I","octolytics-url":"https://collector.github.com/github/collect","og:image:width":"1200","ogSiteName":"GitHub","description":"Implement Standard Schema interface","html-safe-nonce":"c2e3ae1d449d831301763e8d13c7a6079ad504e3bed7ffb992436b2b4017f41f","twitter:image":"https://opengraph.githubassets.com/f96ad6f349e74b0ec36d462f2d1c7ed71d35baeccd31a9739411cc187ec17324/sinclairzx81/typebox/discussions/1152","og:description":"Have you already considered implementing the standard schema interface: https://github.com/standard-schema/standard-schema. This would provide third-party libraries a uniform integration to automat...","octolytics-dimension-repository_is_fork":"false","octolytics-dimension-repository_network_root_nwo":"sinclairzx81/typebox","request-id":"949D:3BA896:4152C0A:53C52FF:69C90C42","visitor-payload":"eyJyZWZlcnJlciI6Imh0dHBzOi8vd3d3Lmdvb2dsZS5jb20vIiwicmVxdWVzdF9pZCI6Ijk0OUQ6M0JBODk2OjQxNTJDMEE6NTNDNTJGRjo2OUM5MEM0MiIsInZpc2l0b3JfaWQiOiI5MDA1OTQxMjkwNjU5NTQ4MjI2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=","current-catalog-service-hash":"9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be","twitter:title":"Implement Standard Schema interface · sinclairzx81/typebox · Discussion #1152","turbo-cache-control":"no-preview","ogTitle":"Implement Standard Schema interface · sinclairzx81/typebox · Discussion #1152","octolytics-dimension-user_id":"3048342","language":"en","color-scheme":"light dark","og:image:alt":"Have you already considered implementing the standard schema interface: https://github.com/standard-schema/standard-schema. This would provide third-party libraries a uniform integration to automat...","og:image:height":"600","turbo-body-classes":"logged-out env-production page-responsive","route-controller":"voltron_discussions_fragments","hovercard-subject-tag":"discussion:7900320","disable-turbo":"false","expected-hostname":"github.com","analytics-location":"/<user-name>/<repo-name>/voltron/discussions_fragments/discussion_layout","user-login":"","octolytics-dimension-repository_network_root_id":"87454905","apple-itunes-app":"app-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/sinclairzx81/typebox/1152/discussion_layout","ogUrl":"https://github.com/sinclairzx81/typebox/discussions/1152","ui-target":"full","visitor-hmac":"74fa5c030cc03e0c4fd5277070b6896140f175eab72116a96e95258435527bab","favicon":"https://github.githubassets.com/favicons/favicon.svg","scrapeId":"019d3957-e1ab-75ba-9af9-cbf0a5f4f368","sourceURL":"https://github.com/sinclairzx81/typebox/discussions/1152","url":"https://github.com/sinclairzx81/typebox/discussions/1152","statusCode":200,"contentType":"text/html; charset=utf-8","timezone":"America/New_York","proxyUsed":"basic","cacheState":"miss","indexId":"8f3a383b-922b-47ab-86ff-f43c6714cf44","creditsUsed":1}},{"url":"https://www.reddit.com/r/typescript/comments/1i3ogwi/announcing_arktype_20_validate_100x_faster_with/","title":"Announcing ArkType 2.0: Validate 100x faster with DX that will blow ...","description":"ArkType 2.0 is a no-setup solution for schema validation with a new style of type-safe API that parallels native type syntax.","position":3}]}} |