Documentation
¶
Index ¶
- func FindImport(file ast.File, alias string) (string, *ast.ImportSpec)
- func GetFieldTypeFormat(t string) string
- type ArrayType
- func (tb ArrayType) AddMethod(f FuncType)
- func (a ArrayType) EqualTo(t Type) bool
- func (tb ArrayType) Field(name string) Type
- func (tb ArrayType) Fields() map[string]Type
- func (tb ArrayType) File() *ast.File
- func (tb ArrayType) GetDescription() string
- func (tb ArrayType) Implements(it InterfaceType) bool
- func (a ArrayType) MarshalJSON() ([]byte, error)
- func (tb ArrayType) Method(name string) *FuncType
- func (tb ArrayType) Methods() map[string]Type
- func (tb ArrayType) Name() string
- func (tb ArrayType) SchemaType() SchemaType
- func (tb ArrayType) SetDescription(desc string)
- func (tb ArrayType) Tag(name string) string
- type BasicType
- func (tb BasicType) AddMethod(f FuncType)
- func (o BasicType) EqualTo(t Type) bool
- func (tb BasicType) Field(name string) Type
- func (tb BasicType) Fields() map[string]Type
- func (tb BasicType) File() *ast.File
- func (tb BasicType) GetDescription() string
- func (tb BasicType) Implements(it InterfaceType) bool
- func (o BasicType) MarshalJSON() ([]byte, error)
- func (tb BasicType) Method(name string) *FuncType
- func (tb BasicType) Methods() map[string]Type
- func (tb BasicType) Name() string
- func (tb BasicType) SchemaType() SchemaType
- func (tb BasicType) SetDescription(desc string)
- func (tb BasicType) Tag(name string) string
- type Call
- func (tb Call) AddMethod(f FuncType)
- func (call Call) Decl() *ast.CallExpr
- func (tb Call) EqualTo(t Type) bool
- func (tb Call) Field(name string) Type
- func (tb Call) Fields() map[string]Type
- func (tb Call) File() *ast.File
- func (tb Call) GetDescription() string
- func (tb Call) Implements(it InterfaceType) bool
- func (tb Call) MarshalJSON() ([]byte, error)
- func (tb Call) Method(name string) *FuncType
- func (tb Call) Methods() map[string]Type
- func (tb Call) Name() string
- func (tb Call) SchemaType() SchemaType
- func (tb Call) SetDescription(desc string)
- func (tb Call) Tag(name string) string
- type Components
- type Content
- type FuncType
- func (FuncType) AddMethod(FuncType)
- func (f FuncType) EqualTo(t Type) bool
- func (tb FuncType) Field(name string) Type
- func (tb FuncType) Fields() map[string]Type
- func (tb FuncType) File() *ast.File
- func (f FuncType) GetBody() []Statement
- func (tb FuncType) GetDescription() string
- func (f FuncType) Implements(it InterfaceType) bool
- func (tb FuncType) MarshalJSON() ([]byte, error)
- func (tb FuncType) Method(name string) *FuncType
- func (tb FuncType) Methods() map[string]Type
- func (tb FuncType) Name() string
- func (f FuncType) ReturnStatements() []ast.ReturnStmt
- func (tb FuncType) SchemaType() SchemaType
- func (tb FuncType) SetDescription(desc string)
- func (tb FuncType) Tag(name string) string
- type IParameter
- type ImportedType
- func (i ImportedType) AddMethod(FuncType)
- func (i ImportedType) EqualTo(t Type) bool
- func (i ImportedType) Field(name string) Type
- func (i ImportedType) Fields() map[string]Type
- func (tb ImportedType) File() *ast.File
- func (tb ImportedType) GetDescription() string
- func (tb ImportedType) Implements(it InterfaceType) bool
- func (i ImportedType) IsWebAPI() bool
- func (tb ImportedType) MarshalJSON() ([]byte, error)
- func (i ImportedType) Method(name string) *FuncType
- func (tb ImportedType) Methods() map[string]Type
- func (tb ImportedType) Name() string
- func (tb ImportedType) SchemaType() SchemaType
- func (i ImportedType) Selector() *ast.SelectorExpr
- func (tb ImportedType) SetDescription(desc string)
- func (tb ImportedType) Tag(name string) string
- type Info
- type InterfaceType
- func (tb InterfaceType) AddMethod(f FuncType)
- func (tb InterfaceType) EqualTo(t Type) bool
- func (tb InterfaceType) Field(name string) Type
- func (tb InterfaceType) Fields() map[string]Type
- func (tb InterfaceType) File() *ast.File
- func (tb InterfaceType) GetDescription() string
- func (tb InterfaceType) Implements(it InterfaceType) bool
- func (tb InterfaceType) MarshalJSON() ([]byte, error)
- func (tb InterfaceType) Method(name string) *FuncType
- func (tb InterfaceType) Methods() map[string]Type
- func (tb InterfaceType) Name() string
- func (tb InterfaceType) SchemaType() SchemaType
- func (tb InterfaceType) SetDescription(desc string)
- func (tb InterfaceType) Tag(name string) string
- type MapType
- func (tb MapType) AddMethod(f FuncType)
- func (m MapType) EqualTo(t Type) bool
- func (tb MapType) Field(name string) Type
- func (tb MapType) Fields() map[string]Type
- func (tb MapType) File() *ast.File
- func (tb MapType) GetDescription() string
- func (tb MapType) Implements(it InterfaceType) bool
- func (tb MapType) MarshalJSON() ([]byte, error)
- func (tb MapType) Method(name string) *FuncType
- func (tb MapType) Methods() map[string]Type
- func (tb MapType) Name() string
- func (tb MapType) SchemaType() SchemaType
- func (tb MapType) SetDescription(desc string)
- func (tb MapType) Tag(name string) string
- type OpenAPISpec
- type ParameterOptionHandler
- type Reference
- type RequestBody
- type Response
- type Route
- type RouteOptionHanlder
- type SchemaType
- type ServerInfo
- type Statement
- type StringType
- func (tb StringType) AddMethod(f FuncType)
- func (s StringType) EqualTo(sch Type) bool
- func (tb StringType) Field(name string) Type
- func (tb StringType) Fields() map[string]Type
- func (tb StringType) File() *ast.File
- func (tb StringType) GetDescription() string
- func (tb StringType) Implements(it InterfaceType) bool
- func (tb StringType) MarshalJSON() ([]byte, error)
- func (tb StringType) Method(name string) *FuncType
- func (tb StringType) Methods() map[string]Type
- func (s StringType) Name() string
- func (tb StringType) SchemaType() SchemaType
- func (tb StringType) SetDescription(desc string)
- func (tb StringType) Tag(name string) string
- type StructType
- func (tb StructType) AddMethod(f FuncType)
- func (o StructType) EqualSchema(s Type) bool
- func (tb StructType) EqualTo(t Type) bool
- func (tb StructType) Field(name string) Type
- func (tb StructType) Fields() map[string]Type
- func (tb StructType) File() *ast.File
- func (tb StructType) GetDescription() string
- func (tb StructType) Implements(it InterfaceType) bool
- func (o StructType) MarshalJSON() ([]byte, error)
- func (tb StructType) Method(name string) *FuncType
- func (tb StructType) Methods() map[string]Type
- func (tb StructType) Name() string
- func (tb StructType) SchemaType() SchemaType
- func (tb StructType) SetDescription(desc string)
- func (tb StructType) Tag(name string) string
- type Type
- func NewBasic(file *ast.File, name string, ident *ast.Ident, tag *ast.BasicLit) Type
- func NewFromObject(file *ast.File, name string, obj *ast.Object, tag *ast.BasicLit) Type
- func NewType(file *ast.File, name string, ts ast.Expr, tag *ast.BasicLit) Type
- func NewTypeFromField(file *ast.File, field *ast.Field) (string, Type)
- func RoutersFunc() Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindImport ¶
func GetFieldTypeFormat ¶
Types ¶
type ArrayType ¶
type ArrayType struct { ItemType Type ArrayType *ast.ArrayType // contains filtered or unexported fields }
func NewSimpleArrayType ¶
func (ArrayType) GetDescription ¶
func (tb ArrayType) GetDescription() string
func (ArrayType) Implements ¶
func (tb ArrayType) Implements(it InterfaceType) bool
func (ArrayType) MarshalJSON ¶
func (ArrayType) SchemaType ¶
func (tb ArrayType) SchemaType() SchemaType
func (ArrayType) SetDescription ¶
func (tb ArrayType) SetDescription(desc string)
type BasicType ¶
type BasicType struct { Value string Ident *ast.Ident Format string `json:"format,omitempty"` // contains filtered or unexported fields }
func NewBasicFromBasicLit ¶
func NewSimpleBasicType ¶
func NewSimpleBasicType(name SchemaType) BasicType
func (BasicType) GetDescription ¶
func (tb BasicType) GetDescription() string
func (BasicType) Implements ¶
func (tb BasicType) Implements(it InterfaceType) bool
func (BasicType) MarshalJSON ¶
func (BasicType) SchemaType ¶
func (tb BasicType) SchemaType() SchemaType
func (BasicType) SetDescription ¶
func (tb BasicType) SetDescription(desc string)
type Call ¶
func (Call) GetDescription ¶
func (tb Call) GetDescription() string
func (Call) Implements ¶
func (tb Call) Implements(it InterfaceType) bool
func (Call) MarshalJSON ¶
func (Call) SchemaType ¶
func (tb Call) SchemaType() SchemaType
func (Call) SetDescription ¶
func (tb Call) SetDescription(desc string)
type Components ¶
type Components struct { Schemas map[string]Type `json:"schemas,omitempty"` Parameters map[string]IParameter `json:"parameters,omitempty"` RequestBodies map[string]RequestBody `json:"requestBodies,omitempty"` Responses map[string]Response `json:"responses,omitempty"` // contains filtered or unexported fields }
func NewComponents ¶
func NewComponents() Components
func (*Components) Add ¶
func (c *Components) Add(comp Components)
type FuncType ¶
type FuncType struct { Parameters []Type Results []Type Statements []interface{} Body []ast.Stmt // contains filtered or unexported fields }
func NewFuncDeclaration ¶
func NewMethodFromField ¶
func (FuncType) GetDescription ¶
func (tb FuncType) GetDescription() string
func (FuncType) Implements ¶
func (f FuncType) Implements(it InterfaceType) bool
func (FuncType) MarshalJSON ¶
func (FuncType) ReturnStatements ¶
func (f FuncType) ReturnStatements() []ast.ReturnStmt
func (FuncType) SchemaType ¶
func (tb FuncType) SchemaType() SchemaType
func (FuncType) SetDescription ¶
func (tb FuncType) SetDescription(desc string)
type IParameter ¶
type ImportedType ¶
type ImportedType struct { Package string // contains filtered or unexported fields }
func NewImported ¶
func NewImported(file *ast.File, selector *ast.SelectorExpr, tag *ast.BasicLit) ImportedType
func NewSimpleImported ¶
func NewSimpleImported(name, path string) ImportedType
func (ImportedType) AddMethod ¶
func (i ImportedType) AddMethod(FuncType)
func (ImportedType) EqualTo ¶
func (i ImportedType) EqualTo(t Type) bool
func (ImportedType) Field ¶
func (i ImportedType) Field(name string) Type
func (ImportedType) Fields ¶
func (i ImportedType) Fields() map[string]Type
func (ImportedType) GetDescription ¶
func (tb ImportedType) GetDescription() string
func (ImportedType) Implements ¶
func (tb ImportedType) Implements(it InterfaceType) bool
func (ImportedType) IsWebAPI ¶
func (i ImportedType) IsWebAPI() bool
func (ImportedType) MarshalJSON ¶
func (ImportedType) Method ¶
func (i ImportedType) Method(name string) *FuncType
func (ImportedType) SchemaType ¶
func (tb ImportedType) SchemaType() SchemaType
func (ImportedType) Selector ¶
func (i ImportedType) Selector() *ast.SelectorExpr
func (ImportedType) SetDescription ¶
func (tb ImportedType) SetDescription(desc string)
type InterfaceType ¶
type InterfaceType struct {
// contains filtered or unexported fields
}
func NewInterface ¶
func NewInterface(file *ast.File, name string, interf *ast.InterfaceType, tag *ast.BasicLit) InterfaceType
func NewInterfaceFields ¶
func NewInterfaceFields(fields map[string]Type) InterfaceType
func RoutersFuncInterface ¶
func RoutersFuncInterface() InterfaceType
func RoutersInterface ¶
func RoutersInterface() InterfaceType
func (InterfaceType) GetDescription ¶
func (tb InterfaceType) GetDescription() string
func (InterfaceType) Implements ¶
func (tb InterfaceType) Implements(it InterfaceType) bool
func (InterfaceType) MarshalJSON ¶
func (InterfaceType) SchemaType ¶
func (tb InterfaceType) SchemaType() SchemaType
func (InterfaceType) SetDescription ¶
func (tb InterfaceType) SetDescription(desc string)
type MapType ¶
func (MapType) GetDescription ¶
func (tb MapType) GetDescription() string
func (MapType) Implements ¶
func (tb MapType) Implements(it InterfaceType) bool
func (MapType) MarshalJSON ¶
func (MapType) SchemaType ¶
func (tb MapType) SchemaType() SchemaType
func (MapType) SetDescription ¶
func (tb MapType) SetDescription(desc string)
type OpenAPISpec ¶
type OpenAPISpec struct { Openapi string `json:"openapi"` Info Info `json:"info"` Servers []ServerInfo `json:"servers"` Components Components `json:"components"` Paths map[string]map[string]Route `json:"paths"` }
func NewOpenAPISpec ¶
func NewOpenAPISpec(servers ...ServerInfo) *OpenAPISpec
type ParameterOptionHandler ¶
type Reference ¶
type Reference struct { Ref string `json:"$ref"` // contains filtered or unexported fields }
func NewReference ¶
type RequestBody ¶
type RequestBody struct { Description string `json:"description,omitempty"` Required bool `json:"required,omitempty"` Content map[string]Content `json:"content"` }
func NewRequestBody ¶
func NewRequestBody(ref Reference) RequestBody
type Response ¶
type Response struct { Description string `json:"description"` Content map[string]Content `json:"content,omitempty"` }
func NewErrorResponse ¶
func NewResponse ¶
type Route ¶
type Route struct { Summary string `json:"summary,omitempty"` Tags []string `json:"tags,omitempty"` Parameters []IParameter `json:"parameters,omitempty"` RequestBody *Reference `json:"requestBody,omitempty"` Responses map[int]*Reference `json:"responses"` Description string `json:"description,omitempty"` }
type RouteOptionHanlder ¶
type SchemaType ¶
type SchemaType string
const ( EmptySchemaType SchemaType = "" ArraySchemaType SchemaType = "array" NumberSchemaType SchemaType = "number" ObjectSchemaType SchemaType = "object" StringSchemaType SchemaType = "string" IntegerSchemaType SchemaType = "integer" BooleanSchemaType SchemaType = "boolean" )
func ConvertFieldType ¶
func ConvertFieldType(t string) SchemaType
type ServerInfo ¶
type StringType ¶
type StringType struct { Data string Basic *ast.BasicLit // contains filtered or unexported fields }
func NewString ¶
func NewString(basic *ast.BasicLit) StringType
func (StringType) EqualTo ¶
func (s StringType) EqualTo(sch Type) bool
func (StringType) GetDescription ¶
func (tb StringType) GetDescription() string
func (StringType) Implements ¶
func (tb StringType) Implements(it InterfaceType) bool
func (StringType) MarshalJSON ¶
func (StringType) Name ¶
func (s StringType) Name() string
func (StringType) SchemaType ¶
func (tb StringType) SchemaType() SchemaType
func (StringType) SetDescription ¶
func (tb StringType) SetDescription(desc string)
type StructType ¶
type StructType struct { StructType *ast.StructType // *BaseSchema Properties map[string]Type `json:"properties,omitempty"` // contains filtered or unexported fields }
func NewStruct ¶
func NewStruct(file *ast.File, name string, str *ast.StructType, tag *ast.BasicLit) StructType
func (StructType) EqualSchema ¶
func (o StructType) EqualSchema(s Type) bool
func (StructType) GetDescription ¶
func (tb StructType) GetDescription() string
func (StructType) Implements ¶
func (tb StructType) Implements(it InterfaceType) bool
func (StructType) MarshalJSON ¶
func (o StructType) MarshalJSON() ([]byte, error)
func (StructType) SchemaType ¶
func (tb StructType) SchemaType() SchemaType
func (StructType) SetDescription ¶
func (tb StructType) SetDescription(desc string)
type Type ¶
type Type interface { Name() string Tag(string) string AddMethod(FuncType) Field(string) Type Method(string) *FuncType Fields() map[string]Type File() *ast.File GetDescription() string SetDescription(string) EqualTo(t Type) bool Implements(InterfaceType) bool SchemaType() SchemaType }
func NewFromObject ¶
func RoutersFunc ¶
func RoutersFunc() Type
Click to show internal directories.
Click to hide internal directories.