Machine-readable API specification formats like OpenAPI are not just for creating documentation but can be a driver for the whole API lifecycle. If you generate them from code you’re leaving half of what OpenAPI can do on the table, so it’s better to develop a specification-first API workflow.
I wrote about this topic as a guest post for Stoplight who offer cloud-based tools around OpenAPI and API design. You can read it in the Stoplight API Corner on Medium.
Disclosure: This work was paid for by Stoplight.