swagger

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 8 Imported by: 0

README

Swagger Viewer

Requires Go 1.16+ to support the //go:embed functionality

Documentation

Index

Constants

View Source
const (
	// DefaultPath is root path docs will be served up unless configured differently
	DefaultPath = "/docs"
)

Variables

View Source
var (
	// ErrServeMuxMustNotBeNil error
	ErrServeMuxMustNotBeNil = errors.New("swagger: serve mux can not be nil")
	// ErrJSONDataMustNotBeNil error
	ErrJSONDataMustNotBeNil = errors.New("swagger: JSON data can not be nil")
)

Functions

This section is empty.

Types

type Swagger

type Swagger struct {
	Spec    spec.Swagger
	Schemes []string
	Path    string
	// contains filtered or unexported fields
}

Swagger holds the basic config and mux

func New

func New(mux *http.ServeMux, jsonData []byte) (*Swagger, error)

New initiates swagger server

func (*Swagger) AddSecurityScheme

func (s *Swagger) AddSecurityScheme(name string, scheme spec.SecurityScheme)

AddSecurityScheme is a helper to add security schemes such as OAuth2, etc.

func (*Swagger) Serve

func (s *Swagger) Serve()

Serve handles the docs, swagger.json, and server.js

Jump to

Keyboard shortcuts

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