Package Exports
- rescript-schema
- rescript-schema/dist/S.js
- rescript-schema/dist/S.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rescript-schema) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ReScript Schema
The fastest composable parser/serializer for ReScript (and TypeScript)
⚠️ Be aware that rescript-schema uses
eval
for parsing. It's usually fine but might not work in some environments like Cloudflare Workers or third-party scripts used on pages with the script-src header.
Highlights:
- Combines validation and transformation without a performance loss
- Can transform parsed value back to the initial format (serializing)
- Works with any Js value, not only
Js.Json.t
- Support for asynchronous transformations
- Immutable API with both result and exception-based operations
- Easy to create recursive schema
- Detailed error messages
- Opt-in strict mode for object schema to prevent excessive fields and many more built-in helpers
- Opt-in PPX to generate schema from type
- Works with plain JavaScript/TypeScript too! You don't need to use ReScript
- The fastest composable validation library in the entire JavaScript ecosystem (benchmark)
- Small JS footprint & tree-shakable API (Comparison with Zod and Valibot)
Also, it has declarative API allowing you to use rescript-schema as a building block for other tools, such as:
- rescript-envsafe - Makes sure you don't accidentally deploy apps with missing or invalid environment variables
- rescript-json-schema - Typesafe JSON schema for ReScript
- Internal form library at Carla