UNPKG

alapa

Version:

A cutting-edge web development framework designed to revolutionize the way developers build modern web applications.

29 lines (28 loc) 1.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.buildPaths = buildPaths; const entry_1 = require("./entry"); function buildPaths() { const collections = entry_1.temporalCollections["routes"] ?? {}; Object.keys(collections).forEach((key) => { const route = collections[key]; entry_1.openApiDefinitionsPaths[key] = {}; Object.keys(route).forEach((method) => { entry_1.openApiDefinitionsPaths[key][method] = {}; const data = route[method]; const operationId = method + "-" + key .trim() .replace(/[\W.]+/g, "-") .replace(/^[-]+|[-]+$/g, ""); entry_1.openApiDefinitionsPaths[key][method] = data; if (!entry_1.openApiDefinitionsPaths[key][method]["operationId"]) { entry_1.openApiDefinitionsPaths[key][method]["operationId"] = operationId; } if (data["tags"] && Array.isArray(data["tags"])) { entry_1.openApiDefinitionsPaths[key][method]["tags"] = data["tags"]; } }); }); }