tjinauyeung / svelte-forms-lib

📝. A lightweight library for managing forms in Svelte
https://svelte-forms-lib-sapper-docs.now.sh/
MIT License
604 stars 59 forks source link

fix: added missing support for generating errors based on yup lazy schema #177

Open CatchABus opened 2 years ago

CatchABus commented 2 years ago

There is the case of a lazy validation schema. In that case, fields needed for errors can only be retrieved if schema's builder method is called.

Lazy schema definition according to yup:

interface SchemaLazyDescription {
  type: string;
  label?: string;
  meta: object | undefined;
}

See how lazy schemas work in yup API docs: https://github.com/jquense/yup#lazyvalue-any--schema-lazy