swagger

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WrapHandler = Handler()

WrapHandler wraps swaggerFiles.Handler and returns http.HandlerFunc.

Functions

func AfterScript

func AfterScript(js string) func(*Config)

AfterScript holds JavaScript to be run right after the Swagger UI object is created and set on the window.

func BeforeScript

func BeforeScript(js string) func(*Config)

BeforeScript holds JavaScript to be run right before the Swagger UI object is created.

func DeepLinking

func DeepLinking(deepLinking bool) func(*Config)

DeepLinking true, false.

func DefaultModelsExpandDepth

func DefaultModelsExpandDepth(defaultModelsExpandDepth ModelsExpandDepthType) func(*Config)

DefaultModelsExpandDepth presents the model of response and request. set the default expansion depth for models

func DocExpansion

func DocExpansion(docExpansion string) func(*Config)

DocExpansion list, full, none.

func DomID

func DomID(domID string) func(*Config)

DomID #swagger-ui.

func Handler

func Handler(configFns ...func(*Config)) http.HandlerFunc

Handler wraps `http.Handler` into `http.HandlerFunc`.

func InstanceName

func InstanceName(name string) func(*Config)

InstanceName set the instance name that was used to generate the swagger documents Defaults to swag.Name ("swagger").

func Layout

func Layout(layout SwaggerLayout) func(*Config)

Define Layout options are BaseLayout or StandaloneLayout

func PersistAuthorization

func PersistAuthorization(persistAuthorization bool) func(*Config)

PersistAuthorization Persist authorization information over browser close/refresh. Defaults to false.

func Plugins

func Plugins(plugins []string) func(*Config)

Plugins specifies additional plugins to load into Swagger UI.

func TemplateContent added in v0.0.7

func TemplateContent(templateContent string) func(*Config)

func UIConfig

func UIConfig(props map[string]string) func(*Config)

UIConfig specifies additional SwaggerUIBundle config object properties.

func URL

func URL(url string) func(*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
	DocExpansion             string
	DomID                    string
	InstanceName             string
	BeforeScript             template.JS
	AfterScript              template.JS
	Plugins                  []template.JS
	UIConfig                 map[template.JS]template.JS
	DeepLinking              bool
	PersistAuthorization     bool
	Layout                   SwaggerLayout
	DefaultModelsExpandDepth ModelsExpandDepthType
	TemplateContent          string
}

Config stores httpSwagger configuration variables.

type ModelsExpandDepthType

type ModelsExpandDepthType int
const (
	ShowModel ModelsExpandDepthType = 1
	HideModel ModelsExpandDepthType = -1
)

type SwaggerLayout

type SwaggerLayout string
const (
	BaseLayout       SwaggerLayout = "BaseLayout"
	StandaloneLayout SwaggerLayout = "StandaloneLayout"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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