Versions in this module Expand all Collapse all v1 v1.1.5 May 24, 2023 v1.1.4 May 24, 2023 Changes in this version + const DefaultServiceVersion + var ErrMissingGoMod = fmt.Errorf("unable to find 'go.mod' for project") + var ErrMultiplePackages = fmt.Errorf("multiple packages defined in input path; should be one") + var ErrMultipleServices = fmt.Errorf("do not define multiple services in a single file") + var ErrNoServices = fmt.Errorf("file does not contain any service interfaces") + var ErrTypeNotContext = fmt.Errorf("not the type 'context.Context'") + var ErrTypeNotError = fmt.Errorf("not the type 'error'") + var ErrTypeNotStructPointer = fmt.Errorf("not a pointer to a struct type") + var ErrTypeNotTwoParams = fmt.Errorf("must have two params") + var ErrTypeNotTwoReturns = fmt.Errorf("must have two return values") + func ApplyFunctionDocumentation(ctx *Context, function *ServiceFunctionDeclaration) + func FindGoDotMod(dirName string) (string, error) + func ParseDocumentation(ctx *Context) (Documentation, Tags, error) + func ParsePackageInfo(ctx *Context) (input *PackageDeclaration, output *PackageDeclaration, err error) + type Context struct + AbsolutePath string + Documentation Documentation + File *ast.File + FileSet *token.FileSet + InputPackage *PackageDeclaration + Module *ModuleDeclaration + OutputPackage *PackageDeclaration + Path string + RawTypes *packages.Package + Service *ServiceDeclaration + Tags Tags + Timestamp time.Time + Types TypeRegistry + func ParseFile(inputPath string) (*Context, error) + func (ctx Context) Scope() *types.Scope + func (ctx Context) TimestampString() string + type Documentation map[string]string + func (docs Documentation) ForField(f *FieldDeclaration) DocumentationLines + func (docs Documentation) ForFunction(f *ServiceFunctionDeclaration) DocumentationLines + func (docs Documentation) ForService(s *ServiceDeclaration) DocumentationLines + func (docs Documentation) ForType(t *TypeDeclaration) DocumentationLines + func (docs Documentation) Set(segmentsAndDoc ...string) + type DocumentationLines []string + func (docs DocumentationLines) Empty() bool + func (docs DocumentationLines) NotEmpty() bool + func (docs DocumentationLines) String() string + func (docs DocumentationLines) Trim() DocumentationLines + type FieldBindingOptions struct + Name string + Omit bool + func ParseBindingOptions(ctx *Context, field *FieldDeclaration, fieldVar *types.Var) *FieldBindingOptions + func (opts FieldBindingOptions) NotOmit() bool + type FieldDeclaration struct + Binding *FieldBindingOptions + Documentation DocumentationLines + Name string + ParentType *TypeDeclaration + Pointer bool + Type *TypeDeclaration + func ApplyFieldDocumentation(ctx *Context, field *FieldDeclaration) *FieldDeclaration + type FieldDeclarations []*FieldDeclaration + func (fields FieldDeclarations) ByBindingName(name string) *FieldDeclaration + func (fields FieldDeclarations) ByName(name string) *FieldDeclaration + func (fields FieldDeclarations) Empty() bool + func (fields FieldDeclarations) NotEmpty() bool + func (fields FieldDeclarations) TransportFields() FieldDeclarations + type GatewayFunctionOptions struct + Function *ServiceFunctionDeclaration + Method string + Path string + Status int + func (opts GatewayFunctionOptions) PathParameters() GatewayParameters + func (opts GatewayFunctionOptions) QueryParameters() GatewayParameters + func (opts GatewayFunctionOptions) SupportsBody() bool + type GatewayParameter struct + Field *FieldDeclaration + Name string + type GatewayParameters []*GatewayParameter + func (params GatewayParameters) ByName(name string) *GatewayParameter + func (params GatewayParameters) Empty() bool + func (params GatewayParameters) NotEmpty() bool + type GatewayServiceOptions struct + PathPrefix string + Service *ServiceDeclaration + type ModuleDeclaration struct + Directory string + Name string + func ParseModuleInfo(ctx *Context) (*ModuleDeclaration, error) + func (module ModuleDeclaration) GoMod() string + type PackageDeclaration struct + Directory string + Import string + Name string + type ServiceDeclaration struct + Documentation DocumentationLines + Functions ServiceFunctionDeclarations + Gateway *GatewayServiceOptions + Name string + Version string + func ApplyServiceDocumentation(ctx *Context, service *ServiceDeclaration) *ServiceDeclaration + func ParseService(ctx *Context) (*ServiceDeclaration, error) + func (service ServiceDeclaration) FunctionByName(name string) *ServiceFunctionDeclaration + type ServiceFunctionDeclaration struct + Documentation DocumentationLines + Gateway *GatewayFunctionOptions + Name string + Request *TypeDeclaration + Response *TypeDeclaration + Service *ServiceDeclaration + func ParseServiceFunction(ctx *Context, service *ServiceDeclaration, funcType *types.Func) (*ServiceFunctionDeclaration, error) + func ParseServiceFunctions(ctx *Context, service *ServiceDeclaration, interfaceType *types.Interface) ([]*ServiceFunctionDeclaration, error) + func (f ServiceFunctionDeclaration) String() string + type ServiceFunctionDeclarations []*ServiceFunctionDeclaration + type Tags map[string]string + func (tags Tags) ForField(f *FieldDeclaration) reflect.StructTag + func (tags Tags) Set(model string, field string, tag *ast.BasicLit) + type TypeDeclaration struct + Basic bool + Documentation DocumentationLines + Elem *TypeDeclaration + Fields FieldDeclarations + Implements struct{ ... } + Key *TypeDeclaration + Kind reflect.Kind + Name string + Type types.Type + func ApplyTypeDocumentation(ctx *Context, t *TypeDeclaration) *TypeDeclaration + func (t TypeDeclaration) MapLike() bool + func (t TypeDeclaration) NonOmittedFields() FieldDeclarations + func (t TypeDeclaration) ObjectLike() bool + func (t TypeDeclaration) PrimitiveLike() bool + func (t TypeDeclaration) SliceLike() bool + func (t TypeDeclaration) String() string + type TypeRegistry map[string]*TypeDeclaration + func NewTypeRegistry() TypeRegistry + func ParseTypes(ctx *Context) (*packages.Package, TypeRegistry, error) + func (reg TypeRegistry) Lookup(t types.Type) (*TypeDeclaration, bool) + func (reg TypeRegistry) LookupByName(name string) (*TypeDeclaration, bool) + func (reg TypeRegistry) NonBasicTypes() []*TypeDeclaration + func (reg TypeRegistry) Register(entry *TypeDeclaration) *TypeDeclaration + func (reg TypeRegistry) WithoutInvalid() TypeRegistry