pablo-abc / felte

An extensible form library for Svelte, Solid and React
https://felte.dev
MIT License
1.01k stars 44 forks source link

Docs validator typo variable #146

Open dawidmachon opened 2 years ago

dawidmachon commented 2 years ago

Describe the bug

On docs: https://felte.dev/docs/svelte/validators#using-yup section Warnings code has typo I think. validator({ schema }), should be validator({ validateSchema }),

import { validator } from '@felte/validator-yup';
import * as yup from 'yup';

const validateSchema = yup.object({
  email: yup.string().email().required(),
  password: yup.string().required(),
});

// We only warn if the user has already started typing a value
const warnSchema = yup.object({
  password: yup
    .string()
    .test('is-secure', 'password is not secure', (value) =>
      value ? value.length > 8 : true
    ),
});

const { form } = createForm({
  // ...
  extend: [
    validator({ schema }),
    validator({ schema: warnSchema, level: 'warning' }),
  ],
  // ...
});

Which package/s are you using?

@felte/validator-yup

Environment

To reproduce

No response

Small reproduction example

No response

Screenshots

No response

Additional context

No response

pablo-abc commented 2 years ago

Hey! I'm really sorry for the delay. What version of validator-yup are you using? Might you be using a pre 1.0.0 version? Since 1.0.0 this package has the API that's currently represented in the docs!