You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Effect Schema as a fourth validation library option alongside Zod, Valibot, and ArkType.
6
+
7
+
Effect Schema is part of the Effect ecosystem and uses a functional approach to schema definition. Unlike the other validators which natively implement Standard Schema, Effect Schema requires wrapping with `Schema.standardSchemaV1()` for use with TanStack Form - this wrapping is handled automatically in generated form options.
8
+
9
+
To use Effect Schema:
10
+
11
+
```typescript
12
+
import { defineConfig } from"tangrams"
13
+
14
+
exportdefaultdefineConfig({
15
+
validator: "effect",
16
+
sources: [/* ... */],
17
+
})
18
+
```
19
+
20
+
Custom scalar mappings for Effect use the `Schema.` prefix:
|`sources`|`SourceConfig[]`| (required) | Array of data sources (minimum 1 required) |
238
238
239
239
### Validator Libraries
240
240
241
-
Tangrams supports three validation libraries that all implement [Standard Schema](https://github.com/standard-schema/standard-schema):
241
+
Tangrams supports four validation libraries that all implement [Standard Schema](https://github.com/standard-schema/standard-schema):
242
242
243
243
| Library | Import | Description |
244
244
|---------|--------|-------------|
245
245
|**Zod**|`zod`| The default. Full-featured schema validation with great TypeScript inference. |
246
246
|**Valibot**|`valibot`| Lightweight alternative with modular design and smaller bundle size. |
247
247
|**ArkType**|`arktype`| Type-first validation with runtime safety and excellent TypeScript integration. |
248
+
|**Effect**|`effect`| Part of the Effect ecosystem. Requires `Schema.standardSchemaV1()` wrapper for TanStack Form. |
248
249
249
-
All three libraries work seamlessly with TanStack Form since they implement the Standard Schema protocol. Choose based on your preferences for bundle size, API style, or existing usage in your project.
250
+
All four libraries work seamlessly with TanStack Form since they implement the Standard Schema protocol. Choose based on your preferences for bundle size, API style, or existing usage in your project.
251
+
252
+
> **Note:** Effect Schema requires wrapping with `Schema.standardSchemaV1()` for Standard Schema compliance. Tangrams handles this automatically in generated form options.
> **Note:** Scalar values must start with a valid prefix for your validator: `z.` for Zod, `v.` for Valibot, or `type(` / `type.` for ArkType. Using raw TypeScript types like `"string"` or `"Date"` will throw a validation error with a helpful suggestion.
417
+
> **Note:** Scalar values must start with a valid prefix for your validator: `z.` for Zod, `v.` for Valibot, `type(` / `type.` for ArkType, or `Schema.` for Effect. Using raw TypeScript types like `"string"` or `"Date"` will throw a validation error with a helpful suggestion.
0 commit comments