Skip to content

Commit 6d0c0b4

Browse files
committed
Added config options to valibotClient
Fixes #590
1 parent ce02939 commit 6d0c0b4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- [Zod 4](https://zod.dev/) adapter added! Adapter names are `zod4` and `zod4Client`, works with both the full version and Zod Mini. As Zod is now using its own JSON Schema representation, and there are some breaking changes like how enums are handled, check migrations carefully and please [report any bugs](https://github.com/ciscoheat/sveltekit-superforms/issues).
1313
- [taintedMessage](https://superforms.rocks/concepts/tainted) now passes `BeforeNavigate` to its callback function.
1414
- [SuperDebug](https://superforms.rocks/super-debug) now has a Runes version, see the docs for how to import it.
15+
- Added config options to `valibotClient`, same as in the `valibot` adapter.
1516

1617
### Changed
1718

src/lib/adapters/valibot.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,15 @@ function _valibot<T extends SupportedSchemas>(
8080
}
8181

8282
function _valibotClient<T extends SupportedSchemas>(
83-
schema: T
83+
schema: T,
84+
options: Omit<ToJSONSchemaOptions, 'schema'> &
85+
AdapterOptions<Infer<T, 'valibot'>> & {
86+
config?: Config<GenericIssue<unknown>>;
87+
} = {}
8488
): ClientValidationAdapter<Infer<T, 'valibot'>, InferIn<T, 'valibot'>> {
8589
return {
8690
superFormValidationLibrary: 'valibot',
87-
validate: async (data) => _validate<T>(schema, data)
91+
validate: async (data) => _validate<T>(schema, data, options?.config)
8892
};
8993
}
9094

0 commit comments

Comments
 (0)