spec

package
v1.0.12-0...-16f252f Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagKey    = "tag"
	NameKey   = "name"
	OptionKey = "option"
	BodyTag   = "json"
)

Variables

View Source
var (
	TagRe       = regexp.MustCompile(`(?P<tag>\w+):"(?P<name>[^,"]+)[,]?(?P<option>[^"]*)"`)
	TagSubNames = TagRe.SubexpNames()
)

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	Name       string
	Properties map[string]string
}

type ApiSpec

type ApiSpec struct {
	Info    Info
	Types   []Type
	Service Service
}

func (*ApiSpec) ContainsTime

func (spec *ApiSpec) ContainsTime() bool

type ArrayType

type ArrayType struct {
	StringExpr string
	// it can be asserted as BasicType: int、bool、
	// PointerType: *string、*User、
	// MapType: map[${BasicType}]interface、
	// ArrayType:[]int、[]User、[]*User
	// InterfaceType: interface{}
	// Type
	ArrayType interface{}
}

type Attribute

type Attribute struct {
	Key string
	// contains filtered or unexported fields
}

type BasicType

type BasicType struct {
	StringExpr string
	Name       string
}

系统预设基本数据类型

type Group

type Group struct {
	Annotations []Annotation
	Routes      []Route
}

type Info

type Info struct {
	Title   string
	Desc    string
	Version string
	Author  string
	Email   string
}

type InterfaceType

type InterfaceType struct {
	StringExpr string
}

type MapType

type MapType struct {
	StringExpr string
	// only support the BasicType
	Key string
	// it can be asserted as BasicType: int、bool、
	// PointerType: *string、*User、
	// MapType: map[${BasicType}]interface、
	// ArrayType:[]int、[]User、[]*User
	// InterfaceType: interface{}
	// Type
	Value interface{}
}

type Member

type Member struct {
	Annotations []Annotation
	Name        string
	// 数据类型字面值,如:string、map[int]string、[]int64、[]*User
	Type string
	// it can be asserted as BasicType: int、bool、
	// PointerType: *string、*User、
	// MapType: map[${BasicType}]interface、
	// ArrayType:[]int、[]User、[]*User
	// InterfaceType: interface{}
	// Type
	Expr interface{}
	Tag  string
	// Deprecated
	Comment string // 换成标准struct中将废弃
	// 成员尾部注释说明
	Comments []string
	// 成员头顶注释说明
	Docs     []string
	IsInline bool
}

func (Member) GetAttributes

func (m Member) GetAttributes() []Attribute

func (Member) GetComment

func (m Member) GetComment() string

func (Member) GetPropertyName

func (m Member) GetPropertyName() (string, error)

func (Member) IsBodyMember

func (m Member) IsBodyMember() bool

func (Member) IsOmitempty

func (m Member) IsOmitempty() bool

func (Member) IsOptional

func (m Member) IsOptional() bool

type PointerType

type PointerType struct {
	StringExpr string
	// it can be asserted as BasicType: int、bool、
	// PointerType: *string、*User、
	// MapType: map[${BasicType}]interface、
	// ArrayType:[]int、[]User、[]*User
	// InterfaceType: interface{}
	// Type
	Star interface{}
}

type Route

type Route struct {
	Annotations  []Annotation
	Method       string
	Path         string
	RequestType  Type
	ResponseType Type
}

type Service

type Service struct {
	Name        string
	Annotations []Annotation
	Routes      []Route
	Groups      []Group
}

type StructType

type StructType struct {
	StringExpr string
}

type TimeType

type TimeType struct {
	StringExpr string
}

type Type

type Type struct {
	Name        string
	Annotations []Annotation
	Members     []Member
}

func (Type) GetBodyMembers

func (t Type) GetBodyMembers() []Member

func (Type) GetNonBodyMembers

func (t Type) GetNonBodyMembers() []Member

Jump to

Keyboard shortcuts

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