Help us shape the future of Go! Take the 2026 Go Developer Survey

swagger

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResponseMimeTypes

func ResponseMimeTypes() []string

Types

type Cell

type Cell struct {
	Typ    string `json:"type"`
	Format string `json:"format,omitempty"`
}

type Contact

type Contact struct {
	Name  string `json:"name"`
	URL   string `json:"url"`
	Email string `json:"email"`
}

type License

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

type Object

type Object struct {
	Typ        string          `json:"type,omitempty"`
	Properties map[string]Cell `json:"properties"`
}

type OperationObject

type OperationObject struct {
	Deprecated  bool                  `json:"deprecated,omitempty"`
	Tags        []string              `json:"tags,omitempty"`
	Summary     string                `json:"summary,omitempty"`
	Description string                `json:"description,omitempty"`
	OperationId string                `json:"operation_id,omitempty"`
	RequestBody *RequestBodyObject    `json:"requestBody,omitempty"`
	Parameters  []ParameterObject     `json:"parameters,omitempty"`
	Responses   map[uint]any          `json:"responses,omitempty"`
	Security    []map[string][]string `json:"security,omitempty"`
}

type ParameterObject

type ParameterObject struct {
	Index           int            `json:"-"`
	Name            string         `json:"name,omitempty"`
	In              string         `json:"in,omitempty"`
	Description     string         `json:"description,omitempty"`
	Required        bool           `json:"required"`
	Schema          map[string]any `json:"schema,omitempty"`
	Deprecated      bool           `json:"deprecated,omitempty"`
	RequestBody     map[string]any `json:"requestBody,omitempty"`
	AllowEmptyValue bool           `json:"allow_empty_value,omitempty"`
	Style           string         `json:"style,omitempty"`
}

type RequestBodyObject

type RequestBodyObject struct {
	Description string         `json:"description,omitempty"`
	Content     map[string]any `json:"content,omitempty"`
	Required    bool           `json:"required,omitempty"`
}

func JsonRefRequestBody

func JsonRefRequestBody(ref string, typ string) *RequestBodyObject

type Server

type Server struct {
	URL         string `json:"url"`
	Description string `json:"description"`
}

type Swagger

type Swagger struct {
	Servers    []Server                              `json:"servers,omitempty"`
	Openapi    string                                `json:"openapi,omitempty"`
	Paths      map[string]map[string]OperationObject `json:"paths,omitempty"`
	Schemes    []string                              `json:"schemes,omitempty"`
	Host       string                                `json:"host,omitempty"`
	Components map[string]any                        `json:"components,omitempty"`
	Info       SwaggerInfo                           `json:"info,omitempty"`
}

func GenSwagger

func GenSwagger(ctx *def.Context) Swagger

type SwaggerInfo

type SwaggerInfo struct {
	Title          string  `json:"title"`
	Description    string  `json:"description"`
	TermsOfService string  `json:"termsOfService"`
	Contact        Contact `json:"contact"`
	License        License `json:"license"`
	Version        string  `json:"version"`
}

Jump to

Keyboard shortcuts

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