"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const yup_1 = require("yup");
const mapValues_1 = __importDefault(require("lodash/mapValues"));
const columnSchema = yup_1.object({
    name: yup_1.string().required(),
    default: yup_1.string().optional()
}).noUnknown();
const col = yup_1.lazy(obj => yup_1.object(mapValues_1.default(obj, (value, key) => {
    // if (key === 'name') {
    // return string().required();
    // }
    // if (key === 'default') {
    // return string().optional();
    // }
    return columnSchema.validateSync(value);
})));
const tableSchema = yup_1.object({
    name: yup_1.string().required().defined().nullable(false),
    columns: col
}).noUnknown();
const parsed = tableSchema.validateSync({
    name: 'table',
    // default: "fuck you"
    columns: {
        'first': {
            name: 'column1',
            default: 'default value 1',
        }
    }
}, { strict: true });
console.log(parsed);
//# sourceMappingURL=yuup.js.map