json-schema-to-yup
Version:
Build a Yup schema from a JSON Schema. Also supports custom/alternative schema models such as GraphQL type defs
17 lines (15 loc) • 311 B
JavaScript
function createYupSchemaEntry({ name, key, value, config }) {
const { YupSchemaEntry } = config || {};
if (!YupSchemaEntry) {
throw "missing YupSchemaEntry class in config";
}
return new YupSchemaEntry({
name,
key,
value,
config
}).toEntry();
}
export {
createYupSchemaEntry
};