@cubicweb/yup
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

@cubicweb/yup

This library exposes a yup validator for working with forms.

Installation

@cubicweb/yup is available from NPM:

# With NPM
npm i @cubicweb/yup
# Or with Yarn
yarn add @cubicweb/yup

Usage

Here is an example usage with react-hook-form:

import {useForm} from "react-hook-form";
import {yupResolver} from "@hookform/resolvers/yup";
import {getValidationSchemaFromYams} from "@cubicweb/yup";

const entityTypeParser = getValidationSchemaFromYams(
    entityTypeSchema,
    errorsTranslations,
    omittedFields
);
const {...} = useForm({
    resolver: yupResolver(entityTypeParser),
});

Documentation

You can find the full documentation with examples here.

Contribute

All @cubicweb libraries are in the cubicwebjs monorepo. Please refer to the main README.

Get Help

Contact us on Matrix and check the roadmap on the CubicWeb Repository.

Package Sidebar

Install

npm i @cubicweb/yup

Weekly Downloads

1

Version

0.2.0

License

LGPL-3.0-or-later

Unpacked Size

48.5 kB

Total Files

12

Last publish

Collaborators

  • fbessou
  • famarger
  • nchauvat