felte icon indicating copy to clipboard operation
felte copied to clipboard

Docs validator typo variable

Open dawidmachon opened this issue 3 years ago • 1 comments

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

  • OS:
  • Browser:
  • Version:

To reproduce

No response

Small reproduction example

No response

Screenshots

No response

Additional context

No response

dawidmachon avatar Jun 11 '22 11:06 dawidmachon

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!

pablo-abc avatar Jul 01 '22 22:07 pablo-abc