rename
This commit is contained in:
2024-03-29 12:12:36 +03:00
parent aa92a0ac3f
commit 0af910b0cf
14 changed files with 109 additions and 159 deletions
+14 -11
View File
@@ -2,11 +2,10 @@
gin middleware to automatically generate RESTful API documentation with Swagger 2.0.
[![Build Status](https://github.com/swaggo/gin-swagger/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/features/actions)
[![Codecov branch](https://img.shields.io/codecov/c/github/swaggo/gin-swagger/master.svg)](https://codecov.io/gh/swaggo/gin-swagger)
[![Go Report Card](https://goreportcard.com/badge/github.com/swaggo/gin-swagger)](https://goreportcard.com/report/github.com/swaggo/gin-swagger)
[![GoDoc](https://godoc.org/github.com/swaggo/gin-swagger?status.svg)](https://godoc.org/github.com/swaggo/gin-swagger)
[![Release](https://img.shields.io/github/release/swaggo/gin-swagger.svg?style=flat-square)](https://github.com/swaggo/gin-swagger/releases)
This is a fork of [gin-swagger](https://github.com/swaggo/gin-swagger)
[![Go Report Card](https://goreportcard.com/badge/git.company.lan/gopkg/gin-swagger)](https://goreportcard.com/report/git.company.lan/gopkg/gin-swagger)
[![GoDoc](https://godoc.org/git.company.lan/gopkg/gin-swagger?status.svg)](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