Skip to content

i-love-flamingo/swagger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flamingo Swagger

This module adds routes that serve the swagger ui (https://swagger.io/tools/swagger-ui/) and a generated swagger.json

Installation

Add the module and the swagger project description to your Flaming bootstrap:

package main

import "flamingo.me/swagger"

// @title My Project
// @version 1.0
// @BasePath /api
func main() {
	flamingo.App([]dingo.Module{
		...
		new(swagger.Module),
	})
}

Make sure that your swagger definition is located under docs/swagger.json

After starting your application please open the path "/api-console/". E.g.: http://localhost:3322/api-console/

Generating swagger file

For generating we recommend to use https://github.com/swaggo/swag

swag init --parseDependency=1 --generalInfo=main.go

This will parse the defined doc comments and generate a file docs/swagger.json

An even better way is to add the following line to your project main file:

//go:generate go run github.com/swaggo/swag/cmd/swag init --parseDependency=1 --generalInfo=main.go

About

Adds Swagger UI (open API) support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages