Is there a way for me to generate a.yaml file (I use Swagger editor) from existing Java code?
I am currently using YAML file to generate Java API code, but I am interested whether the reversed process can be achieved. That is, if I can generate YAML file from the existing Java code?
Generating the swagger documentation from code is a feature proposed by swagger-core. You can add some Java annotations to your code in order to produce the YAML file.
Proposing both code generation and yaml generation is a great feature of swagger that let you choose between using an API-first or code-first approach.
You can find more about swagger annotations here : https://github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X