swagger

package
v0.0.0-...-1ef1c0e Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT     = "default"
	BINDING     = "binding"
	DESCRIPTION = "description"
	QUERY       = "query"
	FORM        = "form"
	URI         = "uri"
	HEADER      = "header"
	COOKIE      = "cookie"
	JSON        = "json"
	RULE        = "rule"
	EXAMPLE     = "example"
	FORMAT      = "format"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(swagger *Swagger)

func Contact

func Contact(contact *openapi3.Contact) Option

func Description

func Description(description string) Option

func DocsUrl

func DocsUrl(url string) Option

func License

func License(lic *openapi3.License) Option

func OpenAPIUrl

func OpenAPIUrl(url string) Option

func RedocOptions

func RedocOptions(options map[string]any) Option

func RedocUrl

func RedocUrl(url string) Option

func Routers

func Routers(routers map[string]map[string]*router.Router) Option

func Servers

func Servers(servers openapi3.Servers) Option

func SwaggerOptions

func SwaggerOptions(options map[string]any) Option

func TermsOfService

func TermsOfService(tos string) Option

func Title

func Title(title string) Option

func Version

func Version(version string) Option

type Swagger

type Swagger struct {
	Title          string
	Description    string
	Version        string
	DocsUrl        string
	RedocUrl       string
	OpenAPIUrl     string
	Routers        map[string]map[string]*router.Router
	Servers        openapi3.Servers
	TermsOfService string
	Contact        *openapi3.Contact
	License        *openapi3.License
	OpenAPI        *openapi3.T
	SwaggerOptions map[string]any
	RedocOptions   map[string]any
}

func New

func New(title, description, version string, options ...Option) *Swagger

func (*Swagger) BuildOpenAPI

func (swagger *Swagger) BuildOpenAPI()

func (*Swagger) MarshalJSON

func (swagger *Swagger) MarshalJSON() ([]byte, error)

func (*Swagger) MarshalYAML

func (swagger *Swagger) MarshalYAML() ([]byte, error)

func (*Swagger) WithContact

func (swagger *Swagger) WithContact(contact *openapi3.Contact) *Swagger

func (*Swagger) WithDescription

func (swagger *Swagger) WithDescription(description string) *Swagger

func (*Swagger) WithDocsUrl

func (swagger *Swagger) WithDocsUrl(url string) *Swagger

func (*Swagger) WithLicense

func (swagger *Swagger) WithLicense(license *openapi3.License) *Swagger

func (*Swagger) WithOpenAPIUrl

func (swagger *Swagger) WithOpenAPIUrl(url string) *Swagger

func (*Swagger) WithRedocOptions

func (swagger *Swagger) WithRedocOptions(options map[string]any) *Swagger

func (*Swagger) WithRedocUrl

func (swagger *Swagger) WithRedocUrl(url string) *Swagger

func (*Swagger) WithServers

func (swagger *Swagger) WithServers(servers []*openapi3.Server) *Swagger

func (*Swagger) WithSwaggerOptions

func (swagger *Swagger) WithSwaggerOptions(options map[string]any) *Swagger

func (*Swagger) WithTermsOfService

func (swagger *Swagger) WithTermsOfService(termsOfService string) *Swagger

func (*Swagger) WithTitle

func (swagger *Swagger) WithTitle(title string) *Swagger

func (*Swagger) WithVersion

func (swagger *Swagger) WithVersion(version string) *Swagger

Jump to

Keyboard shortcuts

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