Skip to content
This repository was archived by the owner on Jan 13, 2026. It is now read-only.

Commit a962208

Browse files
committed
fix
1 parent ccdeb27 commit a962208

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

.changeset/skip-validation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
"better-auth-convex": minor
2+
"better-auth-convex": patch
33
---
44

55
Add `skipValidation` option to `createApi` for smaller generated types. When enabled, uses generic `v.any()` validators instead of typed validators. Since these are internal functions, validation is optional and this can significantly reduce bundle size.

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,12 @@ export const {
168168
findOne,
169169
updateMany,
170170
updateOne,
171-
} = createApi(schema, auth.options);
171+
} = createApi(schema, {
172+
...auth.options,
173+
// Optional: Skip input validation for smaller generated types
174+
// Since these are internal functions, validation is optional
175+
skipValidation: true,
176+
});
172177

173178
// Optional: If you need custom mutation builders (e.g., for custom context)
174179
// Pass internalMutation to both createClient and createApi
@@ -254,6 +259,21 @@ const session = await getSession(ctx);
254259
const headers = await getHeaders(ctx);
255260
```
256261

262+
## API Options
263+
264+
### `skipValidation`
265+
266+
The `createApi` function accepts a `skipValidation` option that uses generic validators instead of typed validators:
267+
268+
```ts
269+
export const { create, ... } = createApi(schema, {
270+
...auth.options,
271+
skipValidation: true, // Smaller generated types
272+
});
273+
```
274+
275+
**When to use**: Enable this option to significantly reduce generated type sizes. Since these are internal functions only called by the auth adapter, input validation is optional. The trade-off is less precise TypeScript inference for the internal API arguments.
276+
257277
## Custom Mutation Builders
258278

259279
Both `createClient` and `createApi` accept an optional `internalMutation` parameter, allowing you to wrap internal mutations with custom context or behavior.

0 commit comments

Comments
 (0)