swag

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 7 Imported by: 0

README

swag-runtime

Runtime dependency for code generated by swag.

Documentation

Index

Constants

View Source
const Name = "swagger"

Name is a unique name be used to register swag instance.

Variables

This section is empty.

Functions

func ReadDoc

func ReadDoc(optionalName ...string) (string, error)

ReadDoc reads swagger document. An optional name parameter can be passed to read a specific document. The default name is "swagger".

func Register

func Register(name string, swagger Swagger)

Register registers swagger for given name.

Types

type Spec

type Spec struct {
	Version          string
	Host             string
	BasePath         string
	Schemes          []string
	Title            string
	Description      string
	InfoInstanceName string
	SwaggerTemplate  string
}

Spec holds exported Swagger Info so clients can modify it.

func (*Spec) InstanceName

func (i *Spec) InstanceName() string

InstanceName returns Spec instance name.

func (*Spec) ReadDoc

func (i *Spec) ReadDoc() string

ReadDoc parses SwaggerTemplate into swagger document.

type Swagger

type Swagger interface {
	ReadDoc() string
}

Swagger is an interface to read swagger document.

func GetSwagger

func GetSwagger(name string) Swagger

GetSwagger returns the swagger instance for given name. If not found, returns nil.

Jump to

Keyboard shortcuts

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