Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Latest commit

 

History

History
24 lines (17 loc) · 541 Bytes

README.md

File metadata and controls

24 lines (17 loc) · 541 Bytes

yup-to-json-schema

Yup is a library to validate the JSON input

JSON-Schema is a schema specification for JSON

This library converts Yup schema to JSON-Schema

Installation

npm i @sodaru/yup-to-json-schema

Usage

import yupToJsonSchema from "@sodaru/yup-to-json-schema"

// see Yup Specification for more options to create yupSchema
const yupSchema = object({
    name: string()
}).required();

const jsonSchema = yupToJsonSchema(yupSchema);