2
votes

I am trying to add documentation to my golang project which has been created using gin-gonic. The problem I am facing currently is that gin-gonic's stable version does not support swagger.

Issue in gin-gonic

Currently when I try to generate the swagger.json its paths are empty. Is there a way in golang to tell it to add end points manually?

go generate
cat swagger.json 
{
  "swagger": "2.0",
  "paths": {},
  "definitions": {}
}

If this is not an option, should I look into a different framework for the same?

1

1 Answers

0
votes

Gin uses goswagger as a base. You could try using goswagger directly

Follow the instructions and the prescribed godoc commenting rules and you should get similar behavior to gin.

FYI, I have not used goswagger myself.