rename
rename
This commit is contained in:
@@ -2,11 +2,10 @@
|
||||
|
||||
gin middleware to automatically generate RESTful API documentation with Swagger 2.0.
|
||||
|
||||
[](https://github.com/features/actions)
|
||||
[](https://codecov.io/gh/swaggo/gin-swagger)
|
||||
[](https://goreportcard.com/report/github.com/swaggo/gin-swagger)
|
||||
[](https://godoc.org/github.com/swaggo/gin-swagger)
|
||||
[](https://github.com/swaggo/gin-swagger/releases)
|
||||
This is a fork of [gin-swagger](https://github.com/swaggo/gin-swagger)
|
||||
|
||||
[](https://goreportcard.com/report/git.company.lan/gopkg/gin-swagger)
|
||||
[](https://godoc.org/git.company.lan/gopkg/gin-swagger)
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -33,17 +32,17 @@ go install github.com/swaggo/swag/cmd/swag@latest
|
||||
swag init
|
||||
```
|
||||
|
||||
4. Download [gin-swagger](https://github.com/swaggo/gin-swagger) by using:
|
||||
4. Download [gin-swagger](https://git.company.lan/gopkg/gin-swagger) by using:
|
||||
|
||||
```sh
|
||||
go get -u github.com/swaggo/gin-swagger
|
||||
go get -u git.company.lan/gopkg/gin-swagger
|
||||
go get -u github.com/swaggo/files
|
||||
```
|
||||
|
||||
Import following in your code:
|
||||
|
||||
```go
|
||||
import "github.com/swaggo/gin-swagger" // gin-swagger middleware
|
||||
import "git.company.lan/gopkg/gin-swagger" // gin-swagger middleware
|
||||
import "github.com/swaggo/files" // swagger embed files
|
||||
|
||||
```
|
||||
@@ -99,10 +98,10 @@ import (
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"git.company.lan/gopkg/gin"
|
||||
docs "github.com/go-project-name/docs"
|
||||
swaggerfiles "github.com/swaggo/files"
|
||||
ginSwagger "github.com/swaggo/gin-swagger"
|
||||
ginSwagger "git.company.lan/gopkg/gin-swagger"
|
||||
"net/http"
|
||||
)
|
||||
// @BasePath /api/v1
|
||||
@@ -148,7 +147,9 @@ Demo project tree, `swag init` is run at relative `.`
|
||||
├── go.sum
|
||||
└── main.go
|
||||
```
|
||||
|
||||
## Project with Nested Directory
|
||||
|
||||
```
|
||||
.
|
||||
├── cmd
|
||||
@@ -168,12 +169,14 @@ Demo project tree, `swag init` is run at relative `.`
|
||||
├── profile.go
|
||||
└── user.go
|
||||
```
|
||||
|
||||
Inorder generate swagger docs for projects with nested directories run the following command
|
||||
|
||||
```bash
|
||||
swag init -g ./cmd/ginsimple/main.go -o cmd/docs
|
||||
```
|
||||
`-o` will set the auto generated file to the specified path
|
||||
|
||||
`-o` will set the auto generated file to the specified path
|
||||
|
||||
## Multiple APIs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user