beegoSwagger

package module
v0.0.0-...-e51c59f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2020 License: MIT Imports: 7 Imported by: 0

README

beego-swagger

Go Report Card

Beego wrapper to automatically serve RESTful API documentation, created with Swagger 2.0. This is simple implementation based on original http swagger: https://github.com/swaggo/http-swagger, changed a bit for Beego web framework.

Usage

Start using it
  1. Add comments to your API source code, See Declarative Comments Format.
  2. Download Swag for Go by using:
$ go get github.com/swaggo/swag/cmd/swag
  1. Run the Swag in your Go project root folder which contains main.go file, Swag will parse comments and generate required files(docs folder and docs/doc.go).
$ swag init

4.Download beego-swagger by using:

$ go get -u github.com/dbohachev/beego-swagger

And import following in your code:

import "github.com/dbohachev/beego-swagger" // beego-swagger middleware

See "example" folder for example "classic" Beego API application.

swagger_index.html

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepLinking

func DeepLinking(deepLinking bool) func(c *Config)

DeepLinking true, false

func DocExpansion

func DocExpansion(docExpansion string) func(c *Config)

DocExpansion list, full, none

func DomID

func DomID(domID string) func(c *Config)

DomID #swagger-ui

func Handler

func Handler(configFns ...func(*Config)) beego.FilterFunc

Handler wraps `http.Handler` into `beego.FilterFunc`.

func URL

func URL(url string) func(c *Config)

URL presents the url pointing to API definition (normally swagger.json or swagger.yaml).

Types

type Config

type Config struct {
	//The url pointing to API definition (normally swagger.json or swagger.yaml). Default is `doc.json`.
	URL          string
	DeepLinking  bool
	DocExpansion string
	DomID        string
}

Config stores httpSwagger configuration variables.

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL