How fuse441/generatorswag works
Project type and purpose
• This is an open-source CLI/HTTP tool (“Generator Swagger”) built on Node.js (runs under bun) that reads XLSX files and produces Swagger-compatible YAML. It reduces manual work in creating API docs by converting a spreadsheet spec into documentation.
File structure
• Top-level files
• app.js – entrypoint, wires up web server (Express/Koa) and routing.
• DockerFile & compose.yaml – containerization and orchestration.
• public/ – static assets (logo, maybe a minimal upload UI).
• src/
• routes – defines HTTP endpoints (e.g., POST /generate).
• controllers – request handlers (generateController).
• services – business logic for parsing XLSX and orchestrating builders.
• builders – modules that translate parsed sheets into Swagger Schema and OpenAPI definitions.
• Helper, utils, libs – cross-cutting utilities (formatting, error handling, constants, logging, general functions).
• middlewares – error handling and request logging.
• configs – environment/configuration management.
README insights
• The README confirms it transforms XLSX → Swagger YAML, supports XML, nested arrays/objects, and is versioned (1.1.0).
• Installation uses bun and nodemon; run app.js to start a watchable server.
• Rounded rectangles for layers (Router, Controller, Service).
• Rectangles for modules (Builders, Utils, Configs).
• XLSX → HTTP POST → Router → … → YAML → HTTP Response or File Export.
• Blue: Web/API layer (app.js, routes, controllers).
• Green: Business logic (services, builders).
• Yellow: Utilities & helpers.
• Gray: Infrastructure (Docker, configs, middlewares).
Detail
• Which modules depend on which (e.g., services reference builders and utils).
• Docker container boundary and the host environment (NODE_ENV, .env).