zeroswagger

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: MIT Imports: 14 Imported by: 0

README

zeroswagger

给Go-Zero的API项目加上Swagger文档。

使用方法

import "github.com/speedphp/zeroswagger"

func main() {
	flag.Parse()

	var c config.Config
	conf.MustLoad(*configFile, &c)

	server := rest.MustNewServer(c.RestConf)
	defer server.Stop()

	ctx := svc.NewServiceContext(c)

	server.AddRoute(zeroswagger.New("/doc").Route())

	handler.RegisterHandlers(server, ctx)

	fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
	server.Start()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JsonPath

type JsonPath struct {
	JsonFile     string `json:"url"`
	Name         string `json:"name"`
	RealFileName string
}

func GenerateApi

func GenerateApi(docPath string, basePath string, tempDir string) []JsonPath

type Plugin

type Plugin struct {
	Api         *spec.ApiSpec
	ApiFilePath string
	Style       string
	Dir         string
}

type ZeroSwaggerHandler

type ZeroSwaggerHandler struct {
	// contains filtered or unexported fields
}

func New

func New(path string) *ZeroSwaggerHandler

func (*ZeroSwaggerHandler) Route

func (m *ZeroSwaggerHandler) Route() rest.Route

Jump to

Keyboard shortcuts

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