Commit f51f29c8 authored by Alex Quispe's avatar Alex Quispe
Browse files

Correción de errores en la verificación de rutas

parent 261176e7
......@@ -48,7 +48,7 @@ class ApidocGenerator {
ROUTES[groupName].forEach(routeInfo => {
const { filePath } = _crearArchivoTemplateSiNoExiste(routeInfo.fileName)
if (!archivosVerificados.includes(filePath)) {
_verificarSiExisteLaRuta(filePath, ROUTES[groupName])
_verificarSiExisteLaRuta(filePath, ROUTES)
archivosVerificados.push(filePath)
}
_crearContenidoSiNoExiste(filePath, routeInfo)
......@@ -498,13 +498,16 @@ function _crearContenidoSiNoExiste (filePath, routeInfo) {
util.writeFile(filePath, content)
}
function _verificarSiExisteLaRuta (filePath, groupInfo) {
function _verificarSiExisteLaRuta (filePath, ROUTES) {
const existInRoutes = (method, path) => {
for(let i in groupInfo) {
const routeInfo = groupInfo[i]
const ROUTE_PATH = `${routeInfo.group === '/default' ? '' : routeInfo.group}${routeInfo.path}`
if (routeInfo.method === method && ROUTE_PATH === path) {
return true
for (let i in ROUTES) {
const groupInfo = ROUTES[i]
for(let i in groupInfo) {
const routeInfo = groupInfo[i]
const ROUTE_PATH = `${routeInfo.group === '/default' ? '' : routeInfo.group}${routeInfo.path}`
if (routeInfo.method === method && ROUTE_PATH === path) {
return true
}
}
}
return false
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment