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
Fix validator schema generation issues discovered through runtime validation testing
6
+
7
+
- Fix Valibot datetime format to use `v.pipe(v.string(), v.isoTimestamp())` instead of `v.isoDateTime()` for proper ISO 8601 validation with seconds and timezone
8
+
- Fix property name double-quoting where names with special characters (e.g., `special-name`) were incorrectly quoted twice in generated schemas
|`sources`|`SourceConfig[]`| (required) | Array of data sources (minimum 1 required) |
229
235
236
+
### Validator Libraries
237
+
238
+
Tangrams supports three validation libraries that all implement [Standard Schema](https://github.com/standard-schema/standard-schema):
239
+
240
+
| Library | Import | Description |
241
+
|---------|--------|-------------|
242
+
|**Zod**|`zod`| The default. Full-featured schema validation with great TypeScript inference. |
243
+
|**Valibot**|`valibot`| Lightweight alternative with modular design and smaller bundle size. |
244
+
|**ArkType**|`arktype`| Type-first validation with runtime safety and excellent TypeScript integration. |
245
+
246
+
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.
247
+
248
+
```typescript
249
+
// Use Zod (default)
250
+
exportdefaultdefineConfig({
251
+
validator: "zod",
252
+
sources: [/* ... */],
253
+
})
254
+
255
+
// Use Valibot for smaller bundles
256
+
exportdefaultdefineConfig({
257
+
validator: "valibot",
258
+
sources: [/* ... */],
259
+
})
260
+
261
+
// Use ArkType for type-first validation
262
+
exportdefaultdefineConfig({
263
+
validator: "arktype",
264
+
sources: [/* ... */],
265
+
})
266
+
```
267
+
268
+
Install your chosen validator as a peer dependency:
269
+
270
+
<Tabsitems={['Zod', 'Valibot', 'ArkType']}>
271
+
<Tabvalue="Zod">
272
+
```bash
273
+
bun add zod
274
+
```
275
+
</Tab>
276
+
<Tabvalue="Valibot">
277
+
```bash
278
+
bun add valibot
279
+
```
280
+
</Tab>
281
+
<Tabvalue="ArkType">
282
+
```bash
283
+
bun add arktype
284
+
```
285
+
</Tab>
286
+
</Tabs>
287
+
230
288
### GraphQL Source Options
231
289
232
290
| Option | Type | Required | Description |
@@ -275,7 +333,7 @@ The `generates` array specifies which TanStack artifacts to generate:
Copy file name to clipboardExpand all lines: apps/docs/content/docs/tanstack-form.mdx
+33-7Lines changed: 33 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,30 +1,56 @@
1
1
---
2
2
title: TanStack Form
3
-
description: Generate formOptions for TanStack Form with Zod validation.
3
+
description: Generate formOptions for TanStack Form with schema validation.
4
4
---
5
5
6
6
# TanStack Form
7
7
8
-
Tangrams generates `formOptions` with Zod validators from your mutations. These snap right into TanStack Form's `useForm` hook.
8
+
Tangrams generates `formOptions` with validation schemas from your mutations. These snap right into TanStack Form's `useForm` hook.
9
+
10
+
By default, Tangrams uses Zod for validation, but you can also use [Valibot or ArkType](/docs#validator-libraries) by setting the `validator` option in your config.
0 commit comments