Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate OpenAPI spec from gin project

Is there a way to generate OpenAPI spec files from a gin project? This issue is really hard to search for, all I could find so far are on doing there reverse.

like image 488
Philippe Avatar asked May 28 '26 21:05

Philippe


1 Answers

gin-swagger is extracting comments from your code.

Running swag init generates :

  • docs.go: To serve SwaggerUI pages
  • swagger.json: The Swagger Specification in json file format.
  • swagger.yaml: The Swagger Specification in yaml file format.
like image 100
mpromonet Avatar answered May 31 '26 18:05

mpromonet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!