json-schema-to-yup
Version:
Build a Yup schema from a JSON Schema. Also supports custom/alternative schema models such as GraphQL type defs
21 lines (18 loc) • 462 B
JavaScript
import defaults from './defaults';
import { createYupSchemaEntry } from '../create-entry';
import { TypeMatcher } from './_type-matcher';
class Base extends TypeMatcher {
constructor(config = {}) {
super(config);
config = {
createYupSchemaEntry,
...config
};
const schemaType = config.schemaType || "json-schema";
const $defaults = defaults[schemaType];
this.config = { ...$defaults, ...config };
}
}
export {
Base
};