'use strict'; const joi = require("joi"); // const checkit = require("checkit"); // const oneOf = require("../../validators/one-of"); module.exports = joi.object({ name: joi.string().required(), description: joi.string(), source: joi.string().required(), url: joi.when("source", { is: "http", then: joi.string().required() }), path: joi.when("source", { is: "local", then: joi.string().required() }) }); // module.exports = checkit({ // name: "string", // description: "string", // source: ["required", "string", oneOf([ // "local", // "http" // ])] // }).maybe({ // url: ["required", "string"] // }, (input) => { // return (input.source === "http"); // }).maybe({ // path: ["required", "string"] // }, (input) => { // return (input.source === "local"); // });