{"id":49799,"library":"xsschema","title":"xsschema","description":"xsschema is an extra-small, Standard Schema-based alternative to typeschema, providing a unified schema validation layer for multiple validation libraries (Zod, ArkType, Effect, Valibot) with JSON Schema generation. Current version is 0.5.0-beta.5 (pre-release). It has no release cadence yet. Key differentiators: standardized adapter interface (Standard Schema), lightweight footprint, and seamless integration with the xsai ecosystem. Ships TypeScript types.","status":"active","version":"0.5.0-beta.5","language":"javascript","source_language":"en","source_url":"https://github.com/moeru-ai/xsai","tags":["javascript","xsai","standard-schema","typeschema","typescript"],"install":[{"cmd":"npm install xsschema","lang":"bash","label":"npm"},{"cmd":"yarn add xsschema","lang":"bash","label":"yarn"},{"cmd":"pnpm add xsschema","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Converts Valibot schemas to JSON Schema","package":"@valibot/to-json-schema","optional":true},{"reason":"Integration with ArkType validation library","package":"arktype","optional":true},{"reason":"Integration with Effect schema validator","package":"effect","optional":true},{"reason":"Integration with sury validation library","package":"sury","optional":true},{"reason":"Integration with Zod validation library","package":"zod","optional":true},{"reason":"Converts Zod schemas to JSON Schema","package":"zod-to-json-schema","optional":true}],"imports":[{"note":"ESM-only package; use dynamic import or bundler for CJS projects.","wrong":"const xsschema = require('xsschema')","symbol":"xsschema","correct":"import { xsschema } from 'xsschema'"},{"note":"Use type import for TypeScript to avoid runtime import.","wrong":"import { Infer } from 'xsschema'","symbol":"type Infer","correct":"import { type Infer } from 'xsschema'"},{"note":"Factory function to create an adapter for a specific validator.","wrong":"","symbol":"createSchemaAdapter","correct":"import { createSchemaAdapter } from 'xsschema'"},{"note":"Not exported as 'toJsonSchema'; use 'jsonSchema' helper.","wrong":"import { toJsonSchema } from 'xsschema'","symbol":"jsonSchema","correct":"import { jsonSchema } from 'xsschema'"}],"quickstart":{"code":"import { xsschema } from 'xsschema';\nimport { z } from 'zod';\n\nconst schema = z.object({ name: z.string(), age: z.number() });\nconst jsonSchema = xsschema.toJSON(schema);\nconsole.log(jsonSchema);\n\nconst adapter = xsschema.getAdapter(schema);\nconst result = adapter.parse({ name: 'Alice', age: 30 });\nconsole.log(result);","lang":"typescript","description":"Creates a Zod schema, converts it to JSON Schema using xsschema, and parses an object with the adapter."},"warnings":[{"fix":"Pin to a specific version and test after upgrade.","message":"The package is in beta; API may change without notice.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Ensure at least one peer dependency is installed.","message":"xsschema requires a validator library (Zod, ArkType, etc.) to be installed; it is not standalone.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace typeschema usage with xsschema's equivalent API.","message":"typeschema adapter is no longer supported; use xsschema directly.","severity":"deprecated","affected_versions":">=0.5.0"}],"env_vars":null,"search_vec":"'0.5.0':36 'adapt':50 'altern':12 'arktyp':26 'base':11 'beta.5':37 'cadenc':45 'current':33 'differenti':48 'ecosystem':62 'effect':27 'extra':6 'extra-smal':5 'footprint':55 'generat':32 'integr':58 'interfac':51 'javascript':66 'json':30 'key':47 'layer':20 'librari':24 'lightweight':54 'multipl':22 'pre':39 'pre-releas':38 'provid':15 'releas':40,44 'schema':10,18,31,53,70 'schema-bas':9 'seamless':57 'ship':63 'small':7 'standard':8,49,52,69 'standard-schema':68 'type':65 'typeschema':14,71 'typescript':64,72 'unifi':17 'valibot':28 'valid':19,23 'version':34 'xsai':61,67 'xsschema':1,2 'yet':46 'zod':25","created_at":"2026-06-07T17:03:40.184292+00:00","updated_at":"2026-06-07T17:03:40.184292+00:00","problems":[{"fix":"Run 'npm install xsschema' and ensure tsconfig.json has 'moduleResolution': 'node16' or 'bundler'.","cause":"Missing installation or TypeScript not resolving the package.","error":"Cannot find module 'xsschema' or its corresponding type declarations."},{"fix":"Use 'xsschema.toJSONSchema' or check documentation for the correct method name.","cause":"The export name is incorrect; 'toJSON' does not exist as a method.","error":"TypeError: xsschema.toJSON is not a function"},{"fix":"Verify that the schema is created with a supported validator (e.g., Zod) and that the corresponding adapter is installed.","cause":"The adapter for the schema type is not registered or the schema is invalid.","error":"Cannot read properties of undefined (reading 'parse')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://xsai.js.org","github":"https://github.com/moeru-ai/xsai","docs":null,"changelog":null,"pypi":null,"npm":"xsschema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}