feat: translate comments and logs to English for better accessibility
This commit is contained in:
@@ -3,9 +3,9 @@ import yaml from 'js-yaml';
|
||||
import { logStep, logInfo, logError } from '../utils/logger';
|
||||
import type { SwaggerAnalysis } from '../types';
|
||||
|
||||
/** Parsea un archivo OpenAPI/Swagger y extrae tags, paths y el documento completo. */
|
||||
/** Parses an OpenAPI/Swagger file and extracts tags, paths and the full document. */
|
||||
export function analyzeSwagger(swaggerFile: string): SwaggerAnalysis {
|
||||
logStep('Analizando archivo OpenAPI...');
|
||||
logStep('Analysing OpenAPI file...');
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(swaggerFile, 'utf8');
|
||||
@@ -14,18 +14,18 @@ export function analyzeSwagger(swaggerFile: string): SwaggerAnalysis {
|
||||
const tags = Array.isArray(swagger.tags) ? swagger.tags : [];
|
||||
const paths = (swagger.paths as Record<string, unknown>) || {};
|
||||
|
||||
logInfo(`Encontrados ${tags.length} tags en el API`);
|
||||
logInfo(`Encontrados ${Object.keys(paths).length} endpoints`);
|
||||
logInfo(`Found ${tags.length} tags in the API`);
|
||||
logInfo(`Found ${Object.keys(paths).length} endpoints`);
|
||||
|
||||
tags.forEach((tag: unknown) => {
|
||||
const t = tag as { name: string; description?: string };
|
||||
logInfo(` - ${t.name}: ${t.description || 'Sin descripción'}`);
|
||||
logInfo(` - ${t.name}: ${t.description || 'No description'}`);
|
||||
});
|
||||
|
||||
return { tags, paths, swagger };
|
||||
} catch (error: unknown) {
|
||||
const err = error as Error;
|
||||
logError(`Error al leer el archivo Swagger: ${err.message}`);
|
||||
logError(`Error reading the Swagger file: ${err.message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user