Skip to content

Commit

Permalink
feat: implement validate options
Browse files Browse the repository at this point in the history
  • Loading branch information
dararod committed Mar 13, 2024
1 parent c112e56 commit 335fd05
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { isSchema, ValidationError } from 'yup';
import { clone } from './utils';

import type { Readable, Unsubscriber, Writable } from 'svelte/store';
import type { Schema } from 'yup';
import type { Schema, ValidateOptions } from 'yup';

export { field } from './action';

Expand Down Expand Up @@ -249,6 +249,8 @@ export type FormConfig<T extends object> = {
* [1]: https://github.com/jquense/yup
*/
validationSchema?: Schema;

validationOption?: ValidateOptions;
};

/**
Expand Down Expand Up @@ -516,9 +518,7 @@ export const newForm: NewFormFn = <T extends object>(
try {
__isValidating.set(true);

await config.validationSchema.validate(currentValues, {
abortEarly: false,
});
await config.validationSchema.validate(currentValues, config.validationOption);
} catch (error) {
console.warn(error);
if (error?.inner) {
Expand Down

0 comments on commit 335fd05

Please sign in to comment.