This team, like many others, followed the standard Go ritual for years: writing detailed comments above handlers, running `swag init`, and mounting Swagger UI. It worked fine when their backend was small, but as things grew, it became a nightmare. One Friday, a frontend engineer discovered their API playground on staging was trying to send requests to `localhost:8080` – a classic 'works on my machine' scenario that exposed deep flaws in their documentation setup.
They faced three major headaches daily with Swagger UI. First, keeping documentation accurate was a constant battle. If you refactored a Go struct but forgot to update the 'magic comments' above your HTTP handler, your docs would lie. For instance, the documentation might claim an endpoint returns a simple string while your actual code returns a complex JSON object. This led to hours of debugging for the frontend team, completely unaware of the doc-code mismatch.
Second, the user experience was incredibly dated. Let's be honest, Swagger UI felt like it was designed when Internet Explorer 8 was still a thing. Trying to test endpoints that needed JWT authentication, navigating deep JSON error schemas, or searching through dozens of endpoints was a painful process, much like dealing with old government websites.
Finally, the generated API spec often included `host: "localhost:8080"`. This meant that when the QA team tried to test API calls on the staging environment, every click on 'Try it out' silently failed, sending requests to a non-existent local server. These issues wasted countless hours and led to frustrating debates about why things weren't working. Switching to Scalar helped them overcome these critical issues, pointing to a clearer path for better API documentation.