UNPKG

expodoc

Version:

A tool to generate API documentation automatically for Express.js applications.

24 lines (23 loc) 913 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateConfig = validateConfig; function validateConfig(config) { const requiredFields = [ "SERVER_URL", "ROUTER_FOLDERS", "ROUTER_FILE_NAMING_PATTERNS", "POSTMAN_CONFIG", ]; for (const field of requiredFields) { if (!config[field]) { throw new Error(`Missing required config field: ${field}`); } } if (!Array.isArray(config.ROUTER_FOLDERS)) { throw new Error("ROUTER_FOLDERS must be an array"); } if (typeof config.SERVER_URL !== "string") { throw new Error("SERVER_URL must be a string"); } return Object.assign(Object.assign({}, config), { IGNORED_FOLDERS: config.IGNORED_FOLDERS || [], IGNORED_FILES: config.IGNORED_FILES || [], ROUTER_MIDDLEWARE_SCOPE_CONFIG: config.ROUTER_MIDDLEWARE_SCOPE_CONFIG || {} }); }