docs

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayItems

type ArrayItems struct {
	Type    string `json:"type,omitempty"`
	Ref     string `json:"$ref,omitempty"`
	Default any    `json:"default,omitempty"`
}

type Contact

type Contact struct {
	Email string `json:"email,omitempty"`
	Url   string `json:"url,omitempty"`
}

type ContentType

type ContentType struct {
	Schema Schema `json:"schema,omitempty"`
}

type Docs

type Docs struct {
	OpenApi      string                      `json:"openapi,omitempty"`
	Host         string                      `json:"host,omitempty"`
	Info         Info                        `json:"info,omitempty"`
	ExternalDocs ExternalDocs                `json:"externalDocs,omitempty"`
	Servers      []Server                    `json:"servers,omitempty"`
	Tags         []Tag                       `json:"tags,omitempty"`
	Paths        map[string]map[string]Path  `json:"paths,omitempty"`
	Components   map[string]map[string]Model `json:"components,omitempty"`
	// contains filtered or unexported fields
}

func New

func New() *Docs

func (*Docs) AddModel

func (docs *Docs) AddModel(name string, m Model)

func (*Docs) AddPath

func (docs *Docs) AddPath(path, method string, p Path)

func (*Docs) AddTag

func (docs *Docs) AddTag(t Tag)

func (*Docs) RemoveModel

func (docs *Docs) RemoveModel(modelName string)

func (*Docs) RemovePath

func (docs *Docs) RemovePath(path string, method ...string)

func (*Docs) RemoveTag

func (docs *Docs) RemoveTag(tagName string)

func (*Docs) Save

func (docs *Docs) Save()

func (*Docs) String

func (docs *Docs) String() string

type ExternalDocs

type ExternalDocs struct {
	Description string `json:"description,omitempty"`
	Url         string `json:"url,omitempty"`
}

type Info

type Info struct {
	Contact     Contact `json:"contact,omitempty"`
	Description string  `json:"description,omitempty"`
	Title       string  `json:"title,omitempty"`
	Version     string  `json:"version,omitempty"`
}

type Model

type Model struct {
	Type           string              `json:"type,omitempty"`
	Properties     map[string]Property `json:"properties,omitempty"`
	Xml            XmL                 `json:"xml,omitempty"`
	RequiredFields []string            `json:"required,omitempty"`
}

type Param

type Param struct {
	Name        string `json:"name,omitempty"`
	In          string `json:"in,omitempty"`
	Description string `json:"description,omitempty"`
	Schema      Schema `json:"schema,omitempty"`
	Style       string `json:"style,omitempty"`
	Required    bool   `json:"required,omitempty"`
	Explode     bool   `json:"explode,omitempty"`
}

type Path

type Path struct {
	Tags        []string            `json:"tags,omitempty"`
	Summary     string              `json:"summary,omitempty"`
	OperationId string              `json:"operationId,omitempty"`
	Requestbody RequestBody         `json:"requestBody,omitempty"`
	Description string              `json:"description,omitempty"`
	Parameters  []Param             `json:"parameters,omitempty"`
	Responses   map[string]Response `json:"responses,omitempty"`
	Consumes    []string            `json:"consumes,omitempty"`
	Produces    []string            `json:"produces,omitempty"`
}

type Property

type Property struct {
	Description string     `json:"description,omitempty"`
	Required    bool       `json:"required,omitempty"`
	Type        string     `json:"type"`
	Format      string     `json:"format,omitempty"`
	Enum        []string   `json:"enum,omitempty"`
	Default     any        `json:"default,omitempty"`
	Example     any        `json:"example,omitempty"`
	Ref         string     `json:"$ref,omitempty"`
	ArrayItem   ArrayItems `json:"items,omitempty"`
}

type RequestBody

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

type Response

type Response struct {
	Description string `json:"description,omitempty"`
}

type Schema

type Schema struct {
	Type       string     `json:"type,omitempty"`
	Format     string     `json:"format,omitempty"`
	Ref        string     `json:"$ref,omitempty"`
	ArrayItems ArrayItems `json:"items,omitempty"`
}

type Server

type Server struct {
	Url string `json:"url,omitempty"`
}

type Tag

type Tag struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

type XmL

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

Jump to

Keyboard shortcuts

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