🌐
Medium
medium.com › @zhengfke › go-go-swagger-generation-and-convert-to-openapi-3-0-3-5f5f8840f7d5
【Go】Go Swagger generation and convert to OpenApi 3.0.3 | by ZhengXiaoMin | Medium
May 29, 2024 - This document describes the process of generating a swagger.json file using the gin framework and gin-swagger, along with potential problems. It also explains how to convert swagger 2.0 to OpenApi 3.0.3.
🌐
Stack Overflow
stackoverflow.com › questions › 77799738 › running-swagger-ui-with-openapi-3-0-yaml-file-in-a-golang-gin-api
go - Running Swagger UI with OpenAPI 3.0 YAML file in a Golang Gin API - Stack Overflow
I am relatively new to Golang and have successfully built a RESTful API using the Gin framework. For API documentation, I initially used Swagger 2.0, but I am now migrating to OpenAPI 3.0 for better support and features.
Discussions

Could this support swagger3.0?
hi,thank you for your extension here, i want to generate swagger 3.0 docs, is this support? More on github.com
🌐 github.com
2
December 18, 2017
Generate Swagger documentation server in Go from Swagger/OpenAPI specification - Stack Overflow
I have an OpenAPI specification and I have used openapi-generator to generate Golang gin server. What is the conventional way to generate Swagger documentation server from the OpenAPI specification... More on stackoverflow.com
🌐 stackoverflow.com
go - Generate OpenAPI spec from gin project - Stack Overflow
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. ... Sign up to request clarification or add additional context in comments. ... This project still generates Swagger v2 specifications. More on stackoverflow.com
🌐 stackoverflow.com
Support OpenAPI 3.1
swaggo/swag now supports OpenAPI 3.1: swaggo/swag#1513 It would be nice so have support for that (see #9) More on github.com
🌐 github.com
2
September 19, 2023
🌐
Reddit
reddit.com › r/golang › swaggo/swag alternative, but should generate openapi 3.0 spec file
r/golang on Reddit: swaggo/swag alternative, but should generate OpenAPI 3.0 spec file
August 24, 2022 -

I have been using https://github.com/swaggo/swag with https://github.com/swaggo/gin-swagger.

Very nice work done there. But I think that project is way behind. OpenAPI v3 has been there for a long time. Are there any similar project which can generate swagger.(yaml|json) based on comments like gin-swagger does?

🌐
Medium
medium.com › @bbakla › open-api-with-go-d75eb3afac19
OpenAPI 3 with Go | by baris bakla | Medium
June 20, 2024 - OpenAPI 3 with Go This guide will help use how to use Swagger in your Go applications. I will demonstrate it using alternative libraries. As a bonus, I will show how to integrate Swagger UI into the …
🌐
GitHub
github.com › swaggo › gin-swagger
GitHub - swaggo/gin-swagger: gin middleware to automatically generate RESTful API documentation with Swagger 2.0. · GitHub
// @BasePath /api/v1 // PingExample ... github.com/go-project-name/docs. ... build your application and after that, go to http://localhost:8080/swagger/index.html ,you to see your Swagger UI....
Starred by 4.2K users
Forked by 294 users
Languages   Go
🌐
GitHub
github.com › swaggo › gin-swagger › issues › 9
Could this support swagger3.0? · Issue #9 · swaggo/gin-swagger
December 18, 2017 - swaggo / gin-swagger Public · Notifications · You must be signed in to change notification settings · Fork 290 · Star 4.1k · New issueCopy link · New issueCopy link · Closed · Closed · Could this support swagger3.0?#9 · Copy link · Labels · question · victor-simida · opened · on Dec 18, 2017 · Issue body actions · hi,thank you for your extension here, i want to generate swagger 3.0 docs, is this support?
Author   victor-simida
🌐
Medium
medium.com › @bordarui › how-to-integrate-swagger-in-your-gin-api-with-go-swagger-generator-f7a407c9b9ba
How to Integrate Swagger in your Gin API with Go Swagger Generator | by ruiborda | Medium
June 3, 2025 - Schema(func(s openapi.Schema) { s.Type("integer").Format("int64") }) }). Response(http.StatusOK, func(r openapi.Response) { r.Description("Operación exitosa - usuario encontrado"). Content(mime.ApplicationJSON, func(mt openapi.MediaType) { mt.SchemaFromDTO(&UserDto{}) }) }). Response(http.StatusNotFound, func(r openapi.Response) { r.Description("Usuario no encontrado") }) }). Doc() func GetUserById(c *gin.Context) { idStr := c.Param("id") c.JSON(http.StatusOK, UserDto{ ID: 1, Name: "John Doe (id: " + idStr + ")", }) } func ConfigureOpenAPI(router *gin.Engine) { router.Use(middleware.SwaggerGin(middleware.SwaggerConfig{ Enabled: true, JSONPath: "/openapi.json", UIPath: "/", Title: "Simple API with OpenAPI 3.0", })) doc := swagger.Swagger() doc.Info(func(info openapi.Info) { info.Title("Simple API").
🌐
DEV Community
dev.to › santosh › how-to-integrate-swagger-ui-in-go-backend-gin-edition-2cbd
How to Integrate Swagger UI in Go Backend - Gin Edition - DEV Community
May 30, 2022 - Unlike FastAPI, Gin does not have OpenAPI integration built in. With FastAPI when you add a route, documentation is already generated. With Gin, this is not the case. But recently I integrated Swagger UI in one of my Go backends and I wanted ...
Find elsewhere
🌐
Vercel
azar-writes-blogs.vercel.app › post › Simplifying-Documentation:-Generate-Swagger-for-Your-Go-Gin-Server-Automatically-with-Swag-831649429ff24428bfaf3f59eb1ad83e
Generate Swagger for Your Go-Gin Server Automatically ...
April 22, 2024 - Swag: Swag is a Go library that automatically generates Swagger documentation for Go-based web servers. It parses Go files containing certain comments and converts them into a Swagger JSON file, which can then be used to generate API documentation. Now that we have a basic understanding, let's ...
🌐
GitHub
github.com › swaggo › gin-swagger › issues › 282
Support OpenAPI 3.1 · Issue #282 · swaggo/gin-swagger
September 19, 2023 - swaggo/swag now supports OpenAPI 3.1: swaggo/swag#1513 It would be nice so have support for that (see #9)
Author   boindil
🌐
Rost Glukhov
glukhov.org › home › posts › adding swagger to your go api
Adding Swagger to Your Go API - Rost Glukhov | Personal site and technical blog
The swaggo library is the most popular tool for adding Swagger support to Go applications. It works by parsing special comments in your code and generating OpenAPI 3.0 specification files.
🌐
Reddit
reddit.com › r/golang › go gin openapi 3.0 generator possible?
r/golang on Reddit: go gin openapi 3.0 generator possible?
August 10, 2022 -

Hi,

I would like to automate the generation of an openapi document based on routes and functions defined for go gin.

There are some derivates already like swag and go-swagger, but things that bother me with both are that its only openapi 2.0, and the fact that it is based on annotations/comment on the actual functions.

Would it be possible in general to create a generator that is not based on annotations? Like via reflection somehow inspecting the router and its routes, middlewares and handler functions in regards to inputs, return types and potential error codes?

Not exactly sure, if possible at all. Thanks in advance!

🌐
GitHub
github.com › getkin › kin-openapi
GitHub - getkin/kin-openapi: OpenAPI 3.0 (and Swagger v2) implementation for Go (parsing, converting, validation, and more) · GitHub
OpenAPI 3.0 (and Swagger v2) implementation for Go (parsing, converting, validation, and more) - getkin/kin-openapi
Starred by 3.2K users
Forked by 495 users
Languages   Go
🌐
Go Packages
pkg.go.dev › github.com › swaggo › gin-swagger
ginSwagger package - github.com/swaggo/gin-swagger - Go Packages
September 2, 2025 - URL presents the url pointing to API definition (normally swagger.json or swagger.yaml). func WrapHandler(handler *webdav.Handler, options ...func(*Config)) gin.HandlerFunc
🌐
GitConnected
levelup.gitconnected.com › tutorial-generate-swagger-specification-and-swaggerui-for-gin-go-web-framework-9f0c038483b5
Tutorial: Generate Swagger Specification and SwaggerUI for Gin Go Web Framework | by Rizal Gowandy | Level Up Coding
September 15, 2021 - $ go get -v github.com/swaggo/swag/cmd/swag $ go get -v github.com/swaggo/gin-swagger $ go get -v github.com/swaggo/files ... If the operation is successful, you should see 3 new files inside folder docs/ginsimple. These files are: ... If you use Confluence to distribute your documentation, you could create a new file inside Confluence and choose to add OpenAPI Specification.
🌐
Reddit
reddit.com › r/golang › how to handle generic type by gin-swagger
r/golang on Reddit: How to handle generic type by gin-swagger
April 16, 2024 -

Hi Friends
I am using gin-swagger to write comments in Go code and automatically generate Open API/Swagger documentation for the REST service exposed externally through these comments.
gin-swagger is just a top-level shell, and the actual work is done by another framework called swag, https://github.com/swaggo/swag/tree/master
A type is defined as follows:
```go
package middleware
type Response struct {
...other fields omitted...
data any
}
```
Add the following comments for the HTTP method in the Controller:
```go
// @Success 200 {object} middleware.Response
// @Success 500 {object} middleware.Response
```
After executing the `swag init`, the OpenAPI was correctly generated, although the result was not what I expected.
To get the expected result, I added a generic type argument to the Response struct:
```go
type Response[T any] struct {
...other fields omitted...
data T
}
```
Then I modified the comments in the HTTP function of the Controller:
```go
// @Success 200 {object} middleware.Response[int]
// @Success 500 {object} middleware.Response[string]
```
After executing the command again to regenerating the OpenAPI, an error occurred: "cannot find type definition".
The swag documentation clearly states that it supports Go generics, and the documentation for this feature can be found [here](https://github.com/swaggo/swag/tree/master?tab=readme-ov-file#how-to-use-generics)
As you can see, the framework explicitly states that it supports this feature, and the usage shown in its documentation is completely consistent with mine.
Finally, when searching for this issue, several issues occurred during the period when Go added generics, and the problems were caused by the users using versions of the frameworks that were too old. However, my version is the latest v1.16.3, which is far beyond the required version for this feature, yet the problem still persists.
Has anyone encountered this issue before?

🌐
DEV Community
dev.to › getpieces › how-to-build-and-document-a-go-rest-api-with-gin-and-go-swagger-jgb
How to Build and Document a Go REST API with Gin and Go-Swagger - DEV Community
March 11, 2024 - The error in the screenshot above is because our server is running on port 8080 and our Swagger UI is not. The UI is making requests to our server from a different origin than the server itself and our server did not specify that this was allowed. We can fix that by adding support for CORS in our main.go file. Let’s replace the import in main.go with the following: import ( "blog-api/routes" "github.com/gin-gonic/gin" cors "github.com/rs/cors/wrapper/gin" )