UNPKG

@netlify/content-engine

Version:
22 lines 836 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateOptionsSchema = validateOptionsSchema; const joi_1 = require("./joi"); const validationOptions = { // Show all errors at once, rather than only the first one every time abortEarly: false, cache: true, }; async function validateOptionsSchema(pluginSchema, pluginOptions, options = { validateExternalRules: true, returnWarnings: true, }) { const { validateExternalRules, returnWarnings } = options; const warnOnUnknownSchema = pluginSchema.pattern(/.*/, joi_1.Joi.any().warning(`any.unknown`)); return (await warnOnUnknownSchema.validateAsync(pluginOptions, { ...validationOptions, externals: validateExternalRules, warnings: returnWarnings, })); } //# sourceMappingURL=validate.js.map