Converts JSON Schema (draft-07) and GraphQL type definitions into Yup validation schemas. Stable version 1.8.8, with monthly releases. Differentiators include support for custom schema extensions, enum titles, and non-standard required property on fields. Also supports GraphQL schema via graphSchemaToJson. Handles common JSON Schema keywords: string (pattern, format, min/maxLength), number (minimum, maximum, exclusive), array (minItems, maxItems), object (required, noUnknown), and mixed types (enum, nullable, oneOf).
npm install json-schema-to-yupNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to convert a JSON Schema object into a Yup validation schema and validate data.
Update to v1.5.0+ and use 'matches' property or pattern keyword. Ensure regular expressions are compatible.
Use enum_titles only if you intend to map enum values to display labels; they are not validated against the enum values.
Replace 'mix' with 'minLength' for strings, 'minimum' for numbers.
Use ISO 8601 format (e.g., '1900-01-01') or ensure format is unambiguous.
Use top-level 'required' array for clarity, and avoid mixing both approaches in the same schema.
Use `import { buildYup } from 'json-schema-to-yup'`Check supported types: string, number, integer, boolean, object, array, date. Remove or rename unsupported types.
Ensure the field type is 'number' or 'integer' in JSON Schema, not missing or 'string'.
Install yup: `npm install yup` or `yarn add yup`