Unfortunately, most useful tools for generating static documentation from a swagger spec are no longer maintained or only support swagger's 2.0 format -- we are using the 3.0 format.
The only tool I could find was swagger-codegen, which is built in and requires dependencies in (gag) Java.
Codegen allows us to generate a single-page static document:
swagger-codegen generate \
-i ./swagger.spec.json \
-l html \
-o ./build/static/ \
-c ./swagger-codegen.json
This does get us a doc page, but without many of the details that would make it useful. In fact, many of the anchor links it includes reference sections that don't even exist on the page.
Needless to say, this was a bust. It may be possible for us to build our own templates (see their source templates), but I don't want to go down that rabbit hole just yet.
It also lets us generate a "dynamic html" version, which is essentially a bunch of static html/js/css and an express app to serve it:
swagger-codegen generate \
-i ./swagger.spec.json \
-l dynamic-html \
-o build/dynamic/ \
-c ./swagger-codegen.json
We could pull these statically served files out to another directory:
mv ./build/dynamic/docs ./generated
And then serve them as part of our API:
app.use('/static-docs', express.static(path.resolve(__dirname + "/../generated")) );
However, they're not that thorough as (again) a lot of the detail is lost. Additionally, html served statically through the app is antithetical to my purpose here, which was to have offline documentation we could commit to the repo.
Unless we can find (or build) a tool that gives us plain text or markdown, I don't see a way to build useful and comprehensive offline documentation.
Maybe someone else can come back and accomplish this in the future, but for now if you need the docs, you'll have to clone and run the app locally, to use the /docs
endpoint.