@cubicweb/yup

@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.

Generated using TypeDoc