You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
782 B
JavaScript
32 lines
782 B
JavaScript
'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");
|
|
// });
|