documents

package
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document added in v1.0.10

type Document struct {
	// Name
	// as tag
	Name string `json:"name"`
	// Description
	// as description of tag, support markdown
	Description string `json:"description"`
	// Version
	Version versions.Version `json:"version"`
	// Fns
	Fns []*Fn `json:"fns"`
	// Elements
	Elements map[string]*Element `json:"elements"`
}

func NewDocument added in v1.0.10

func NewDocument(name string, description string, ver versions.Version) *Document

func (*Document) AddFn added in v1.0.10

func (doc *Document) AddFn(name string, title string, description string, hasAuthorization bool, deprecated bool, arg *Element, result *Element, errs []Error)

type Documents added in v1.0.10

type Documents map[string]VersionSortedDocuments

func NewDocuments added in v1.0.10

func NewDocuments() Documents

func (Documents) Add added in v1.0.10

func (documents Documents) Add(doc *Document) (ok bool)

func (Documents) FindByVersion added in v1.0.10

func (documents Documents) FindByVersion(version versions.Version) (v NameSortedDocuments)

func (Documents) Len added in v1.0.10

func (documents Documents) Len() int

func (Documents) Merge added in v1.0.10

func (documents Documents) Merge(o Documents) Documents

func (Documents) Openapi added in v1.0.10

func (documents Documents) Openapi(openapiVersion string, appId string, appName string, appVersion versions.Version) (api *oas.API)

func (Documents) Remove added in v1.0.10

func (documents Documents) Remove(name string, version versions.Version)

type Element

type Element struct {
	Path        string              `json:"path,omitempty"`
	Name        string              `json:"name,omitempty"`
	Title       string              `json:"title,omitempty"`
	Description string              `json:"description,omitempty"`
	Type        string              `json:"type,omitempty"`
	Format      string              `json:"format,omitempty"`
	Enums       []string            `json:"enums,omitempty"`
	Required    bool                `json:"required,omitempty"`
	Validation  *ElementValidation  `json:"validation,omitempty"`
	Properties  map[string]*Element `json:"properties,omitempty"`
	Additional  bool                `json:"additional,omitempty"`
	Deprecated  bool                `json:"deprecated,omitempty"`
}

func Any added in v0.14.0

func Any() *Element

func Array

func Array(item *Element) *Element

func Bool

func Bool() *Element

func Bytes added in v0.14.0

func Bytes() *Element

func Complex128 added in v0.14.0

func Complex128() *Element

func Complex64 added in v0.14.0

func Complex64() *Element

func Date

func Date() *Element

func DateTime

func DateTime() *Element

func Duration added in v0.14.0

func Duration() *Element

func Empty

func Empty() *Element

func Float32

func Float32() *Element

func Float64

func Float64() *Element

func Ident added in v0.14.0

func Ident(path string, name string, target *Element) *Element

func Int

func Int() *Element

func Int32

func Int32() *Element

func Int64

func Int64() *Element

func JsonRaw

func JsonRaw() *Element

func Map

func Map(value *Element) *Element

func NewElement

func NewElement(path string, name string, typ string, format string, title string, description string) *Element

func Password added in v1.0.5

func Password() *Element

func Ref added in v0.14.0

func Ref(path string, name string) *Element

func String

func String() *Element

func Struct

func Struct(path string, name string) *Element

func Time added in v0.14.0

func Time() *Element

func Uint added in v0.14.0

func Uint() *Element

func Uint32 added in v0.14.0

func Uint32() *Element

func Uint64 added in v0.14.0

func Uint64() *Element

func Uint8 added in v0.14.0

func Uint8() *Element

func (*Element) AddEnum

func (element *Element) AddEnum(v ...string) *Element

func (*Element) AddProperty

func (element *Element) AddProperty(name string, prop *Element) *Element

func (*Element) AsDeprecated

func (element *Element) AsDeprecated() *Element

func (*Element) AsPassword added in v1.0.5

func (element *Element) AsPassword() *Element

func (*Element) AsRequired

func (element *Element) AsRequired() *Element

func (*Element) Key

func (element *Element) Key() (v string)

func (*Element) Schema

func (element *Element) Schema() (v *oas.Schema)

func (*Element) SetDescription

func (element *Element) SetDescription(description string) *Element

func (*Element) SetFormat

func (element *Element) SetFormat(format string) *Element

func (*Element) SetName added in v0.14.0

func (element *Element) SetName(name string) *Element

func (*Element) SetPath added in v0.14.0

func (element *Element) SetPath(path string) *Element

func (*Element) SetTitle

func (element *Element) SetTitle(title string) *Element

func (*Element) SetValidation

func (element *Element) SetValidation(validation *ElementValidation) *Element

type ElementValidation added in v0.14.0

type ElementValidation struct {
	Name string            `json:"name,omitempty"`
	I18n map[string]string `json:"i18n,omitempty"`
}

func NewElementValidation added in v0.14.0

func NewElementValidation(name string, i18ns ...string) (v *ElementValidation)

type Elements added in v0.14.0

type Elements []*Element

func (Elements) Len added in v0.14.0

func (elements Elements) Len() int

func (Elements) Less added in v0.14.0

func (elements Elements) Less(i, j int) bool

func (Elements) Swap added in v0.14.0

func (elements Elements) Swap(i, j int)

type Error added in v1.0.10

type Error struct {
	Name_         string
	Descriptions_ map[string]string
}

func (Error) Descriptions added in v1.0.10

func (e Error) Descriptions() map[string]string

func (Error) Name added in v1.0.10

func (e Error) Name() string

type Fn

type Fn struct {
	Name          string   `json:"name,omitempty"`
	Title         string   `json:"title,omitempty"`
	Description   string   `json:"description,omitempty"`
	Authorization bool     `json:"authorization,omitempty"`
	Argument      *Element `json:"argument,omitempty"`
	Result        *Element `json:"result,omitempty"`
	Deprecated    bool     `json:"deprecated,omitempty"`
	Errors        []Error  `json:"errors,omitempty"`
}

type NameSortedDocuments added in v1.0.10

type NameSortedDocuments []*Document

func (NameSortedDocuments) Len added in v1.0.10

func (documents NameSortedDocuments) Len() int

func (NameSortedDocuments) Less added in v1.0.10

func (documents NameSortedDocuments) Less(i, j int) bool

func (NameSortedDocuments) Swap added in v1.0.10

func (documents NameSortedDocuments) Swap(i, j int)

type VersionSortedDocuments added in v1.0.10

type VersionSortedDocuments []*Document

func (VersionSortedDocuments) Get added in v1.0.10

func (documents VersionSortedDocuments) Get(version versions.Version) (document *Document, has bool)

func (VersionSortedDocuments) Len added in v1.0.10

func (documents VersionSortedDocuments) Len() int

func (VersionSortedDocuments) Less added in v1.0.10

func (documents VersionSortedDocuments) Less(i, j int) bool

func (VersionSortedDocuments) Merge added in v1.0.10

func (VersionSortedDocuments) Swap added in v1.0.10

func (documents VersionSortedDocuments) Swap(i, j int)

Jump to

Keyboard shortcuts

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