swgui

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2018 License: Apache-2.0 Imports: 0 Imported by: 0

README

Swagger UI

GoDoc

Package swgui (Swagger UI) provide a HTTP handler to serve Swagger UI. All assets are embedded in GO source code, so just build and run.

How to use

package main

import (
    "net/http"

    "github.com/swaggest/swgui/v3"
)

func main() {
    http.Handle("/", v3.NewHandler("My API", "/swagger.json", "/"))
    http.ListenAndServe(":8080", nil)
}

Run as standalone server

Install swgui-server

go get github.com/swaggest/swgui/...

Start server

swgui-server -port 8080

Documentation

Overview

Package swgui provide a http FileSystem handler for swagger UI interface

How to generate asset files:

1. Install tools:

go get -u github.com/shurcooL/vfsgen

2. Generate file:

At root folder, run command:

go generate

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.0.0

type Config struct {
	Title       string `json:"title"`          // title of index file
	SwaggerJSON string `json:"swaggerJsonUrl"` // url to swagger.json document specification
	BasePath    string `json:"basePath"`       // base url to docs

	ShowTopBar         bool              `json:"showTopBar"`         // Show navigation top bar, hidden by default
	JsonEditor         bool              `json:"jsonEditor"`         // Enable visual json editor support (experimental, can fail with complex schemas)
	PreAuthorizeApiKey map[string]string `json:"preAuthorizeApiKey"` // Map of security name to key value
}

Config is used for Swagger UI handler configuration

Directories

Path Synopsis
v2
gen
v3
gen

Jump to

Keyboard shortcuts

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