Question: I inherited an existing API and I would like to document it with swagger, but I don't yet know the full scope of it. Can Swagger (or another middleware/tool) auto-magically generate the yaml (for swagger) based on the existing express routes?

For what I saw on other questions, it would appear that this is mostly a manual job, but I'm double-checking if someone here found a way around this.

Answer: 
There is an option: you can embed middleware that will analyse all requests and responses and generate specification for you: <https://github.com/mpashkovskiy/express-oas-generator>

Then you can use it through your's app Swagger UI like <http://host:port/api-docs>
Have a look to [swagger-jsdoc](https://github.com/Surnet/swagger-jsdoc). It's a different approach.

The docs stick to the code, and also lets the express code to remain pure.

Guides:

* <https://dev.to/acanimal/express-api-with-autogenerated-openapi-doc-through-swagger-7na>
* <https://dev.to/akshendra/generating-documentation-on-the-fly-in-express-2652>