miha1908 miha1908 - 1 year ago 165
Java Question

Generating a .yaml file from existing Java code?

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?

gvo gvo
Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download