swagfs

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: MIT Imports: 6 Imported by: 0

README

swagfs

Swagger-UI

Update dist files in files/dist/*

./swagger-ui-dist.sh 4.15.5

Example

Use echo

package main

import (
	"log"

	"github.com/a-kataev/swagfs"
	"github.com/labstack/echo/v4"
)

func main() {
	e := echo.New()

	cfg := &swagfs.Config{}
	cfg.AddURL("https://petstore.swagger.io/v2/swagger.json", "petstore")
	cfg.SetLayout("StandaloneLayout")

	e.StaticFS("/*", swagfs.FS(cfg))
	
	if err := e.Start("127.0.0.1:8080"); err != nil {
		log.Fatal(err)
	}
}

Documentation

Index

Constants

View Source
const (
	BaseLayout       = "BaseLayout"
	StandaloneLayout = "StandaloneLayout"
)

Variables

This section is empty.

Functions

func FS

func FS(templates ...tmpl.File) fs.FS

Types

type Config

type Config struct {
	Urls   []URL  `json:"urls"`
	Layout Layout `json:"layout"`
}

func NewConfig

func NewConfig() *Config

func (*Config) AddURL

func (c *Config) AddURL(url, name string) *Config

func (*Config) Filename

func (c *Config) Filename() string

func (*Config) SetLayout

func (c *Config) SetLayout(layout Layout) *Config

func (*Config) TagFunc

func (c *Config) TagFunc(w io.Writer, tag string) (int, error)

func (*Config) Template

func (c *Config) Template() string

type Layout

type Layout string

type URL

type URL struct {
	URL  string `json:"url"`
	Name string `json:"name,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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