All Projects → gogf → swagger

gogf / swagger

Licence: other
Swagger wrapper for GoFrame project.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to swagger

gfstudy
go frame框架基础介绍
Stars: ✭ 89 (+196.67%)
Mutual labels:  gf, goframe
gf-home
Source codes of GoFrame home site.
Stars: ✭ 67 (+123.33%)
Mutual labels:  gf, goframe
gtoken
基于gf框架的token插件,通过服务端验证方式实现token认证;
Stars: ✭ 181 (+503.33%)
Mutual labels:  gf
gf-jwt
GoFrame HTTP JWT middleware.
Stars: ✭ 72 (+140%)
Mutual labels:  goframe
gf-wordnet
A WordNet in GF
Stars: ✭ 15 (-50%)
Mutual labels:  gf
Gf
GoFrame is a modular, powerful, high-performance and enterprise-class application development framework of Golang.
Stars: ✭ 6,501 (+21570%)
Mutual labels:  goframe
focus-single
Single repo demo project using GoFrame.
Stars: ✭ 26 (-13.33%)
Mutual labels:  goframe
focus
Community system build using GoFrame.
Stars: ✭ 103 (+243.33%)
Mutual labels:  goframe

This repository is not maintained anymore. Please use the latest v2 version of goframe for automatic API generating and swagger UI feature.

swagger

Provides swagger API document feature for GoFrame project.

Usage

1. Install gf cli tool

Download and install gf cli tool: https://github.com/gogf/gf/tree/master/cmd/gf

2. Install gf-swagger

go get -u github.com/gogf/swagger/v2

3. Produce and pack swagger.json

Use v1 version command gf swagger --pack parses and produces the /swagger/swagger.json file and packs it to /packed/swagger.go.

You can also use gf run main.go --swagger -y running your codes with hot-compiled-like feature and automatically packs the swagger files into your project.

4. Use the swagger plugin

Install the swagger using as plugin:

package main

import (
    "github.com/gogf/gf/v2/frame/g"
    "github.com/gogf/swagger/v2"
)

func main() {
    s := g.Server()
    s.Plugin(&swagger.Swagger{})
    s.SetPort(8199)
    s.Run()
}

Start your server and visit: http://127.0.0.1:8199/swagger

Enjoy!

Comment and configuration

As the swagger files parsed and produced by third party tool, you can get details about comment at: https://github.com/swaggo/swag .

GF swagger feature also supports configuration from file with swagger node. Supported configuration item names of the node please refer to the attribute names of Swagger struct: https://godoc.org/github.com/gogf/swagger/v2

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].