Documentation ¶
Overview ¶
Doctree, which stands for "documentation tree", creates a tree of nodes representing the components of a service defined through Protobuf definition files. The tree is composed of nodes fulfilling the `Describable` interface, with the root node fulfilling the `Doctree` interface. The `Doctree` interface is a superset of the `Describable` interface.
The main entrypoint for the Doctree package is the `New` function, which takes a Protobuf `CodeGeneratorRequest` struct and creates a Doctree representing all the documentation from the `CodeGeneratorRequest`.
For a larger explanation of how and why Doctree is structured the way it is, see the comment for the 'associateComments' function in the source code of the 'associate_comments.go' file.
Index ¶
- func AssociateComments(dt Doctree, req *plugin.CodeGeneratorRequest)
- type BindingField
- type Describable
- type Doctree
- type EnumValue
- type FieldType
- type HttpParameter
- func (self *HttpParameter) Describe(depth int) string
- func (self *HttpParameter) GetByName(s string) Describable
- func (self *HttpParameter) GetDescription() string
- func (self *HttpParameter) GetName() string
- func (self *HttpParameter) SetDescription(d string)
- func (self *HttpParameter) SetName(s string)
- type MessageField
- type MethodHttpBinding
- func (self *MethodHttpBinding) Describe(depth int) string
- func (self *MethodHttpBinding) GetByName(s string) Describable
- func (self *MethodHttpBinding) GetDescription() string
- func (self *MethodHttpBinding) GetName() string
- func (self *MethodHttpBinding) SetDescription(d string)
- func (self *MethodHttpBinding) SetName(s string)
- type MicroserviceDefinition
- func (self *MicroserviceDefinition) Describe(depth int) string
- func (self *MicroserviceDefinition) GetByName(name string) Describable
- func (self *MicroserviceDefinition) GetDescription() string
- func (self *MicroserviceDefinition) GetName() string
- func (self *MicroserviceDefinition) Markdown() string
- func (self *MicroserviceDefinition) SetComment(namepath []string, comment_body string)
- func (self *MicroserviceDefinition) SetDescription(d string)
- func (self *MicroserviceDefinition) SetName(s string)
- func (self *MicroserviceDefinition) String() string
- type ProtoEnum
- type ProtoFile
- type ProtoMessage
- func (self *ProtoMessage) Describe(depth int) string
- func (self *ProtoMessage) GetByName(name string) Describable
- func (self *ProtoMessage) GetDescription() string
- func (self *ProtoMessage) GetName() string
- func (self *ProtoMessage) SetDescription(d string)
- func (self *ProtoMessage) SetName(s string)
- type ProtoService
- func (self *ProtoService) Describe(depth int) string
- func (self *ProtoService) GetByName(name string) Describable
- func (self *ProtoService) GetDescription() string
- func (self *ProtoService) GetName() string
- func (self *ProtoService) SetDescription(d string)
- func (self *ProtoService) SetName(s string)
- type ServiceMethod
- func (self *ServiceMethod) Describe(depth int) string
- func (self *ServiceMethod) GetByName(name string) Describable
- func (self *ServiceMethod) GetDescription() string
- func (self *ServiceMethod) GetName() string
- func (self *ServiceMethod) SetDescription(d string)
- func (self *ServiceMethod) SetName(s string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssociateComments ¶
func AssociateComments(dt Doctree, req *plugin.CodeGeneratorRequest)
Types ¶
type BindingField ¶
type BindingField struct { Describable Name string Description string Kind string Value string }
BindingField represents a single field within an `option` annotation for an rpc method. For example, an rpc method may have an http annotation with fields like `get: "/example/path"`. Each of those fields is represented by a `BindingField`. The `Kind` field is the left side of the option field, and the `Value` is the right hand side of the option field.
func (*BindingField) Describe ¶
func (self *BindingField) Describe(depth int) string
func (*BindingField) GetByName ¶
func (self *BindingField) GetByName(s string) Describable
func (*BindingField) GetDescription ¶
func (self *BindingField) GetDescription() string
func (*BindingField) GetName ¶
func (self *BindingField) GetName() string
func (*BindingField) SetDescription ¶
func (self *BindingField) SetDescription(d string)
func (*BindingField) SetName ¶
func (self *BindingField) SetName(s string)
type Describable ¶
type Describable interface { // The "Name" of this describable GetName() string SetName(string) // GetDescription returns the description of this describable GetDescription() string SetDescription(string) // describe causes a Describable to generate a string representing itself. // The integer argument is used as the 'depth' that this Describable sits // within a tree of Describable structs, allowing it to print its // information with proper indentation. If called recursively, allows for // printing of a structured tree-style view of a tree of Describables. Describe(int) string // GetByName allows one to query a Describable to see if it has a child // Describable in any of its collections. GetByName(string) Describable // contains filtered or unexported methods }
Describable offers an interface for traversing a Doctree and finding information from the nodes within it.
type Doctree ¶
type Doctree interface { Describable SetComment([]string, string) String() string Markdown() string }
Doctree is the root interface for this package, and is chiefly implemented by MicroserviceDefinition. See MicroserviceDefinition for further documentation on these Methods.
type EnumValue ¶
type EnumValue struct { Describable Name string Description string Number int }
func (*EnumValue) GetDescription ¶
func (*EnumValue) SetDescription ¶
type FieldType ¶
type FieldType struct { Describable Name string Description string Enum *ProtoEnum }
func (*FieldType) GetByName ¶
func (self *FieldType) GetByName(s string) Describable
func (*FieldType) GetDescription ¶
func (*FieldType) SetDescription ¶
type HttpParameter ¶
type HttpParameter struct { Describable Name string Description string Location string Type string }
HttpParameter contains information for one parameter of an http binding. It is created by contextualizing all of the `BindingField`'s within a `MethodHttpBinding`, with each `HttpParameter` corresponding to one of the fields in the input message for the given rpc method. It's type is the protobuf type of the field of the struct it's refering to.
func (*HttpParameter) Describe ¶
func (self *HttpParameter) Describe(depth int) string
func (*HttpParameter) GetByName ¶
func (self *HttpParameter) GetByName(s string) Describable
func (*HttpParameter) GetDescription ¶
func (self *HttpParameter) GetDescription() string
func (*HttpParameter) GetName ¶
func (self *HttpParameter) GetName() string
func (*HttpParameter) SetDescription ¶
func (self *HttpParameter) SetDescription(d string)
func (*HttpParameter) SetName ¶
func (self *HttpParameter) SetName(s string)
type MessageField ¶
type MessageField struct { Describable Name string Description string Type FieldType Number int // Label is one of either "LABEL_OPTIONAL", "LABEL_REPEATED", or // "LABEL_REQUIRED" Label string }
func (*MessageField) Describe ¶
func (self *MessageField) Describe(depth int) string
func (*MessageField) GetByName ¶
func (self *MessageField) GetByName(s string) Describable
func (*MessageField) GetDescription ¶
func (self *MessageField) GetDescription() string
func (*MessageField) GetName ¶
func (self *MessageField) GetName() string
func (*MessageField) SetDescription ¶
func (self *MessageField) SetDescription(d string)
func (*MessageField) SetName ¶
func (self *MessageField) SetName(s string)
type MethodHttpBinding ¶
type MethodHttpBinding struct { Describable Name string Description string Verb string Path string Fields []*BindingField Params []*HttpParameter }
func (*MethodHttpBinding) Describe ¶
func (self *MethodHttpBinding) Describe(depth int) string
func (*MethodHttpBinding) GetByName ¶
func (self *MethodHttpBinding) GetByName(s string) Describable
func (*MethodHttpBinding) GetDescription ¶
func (self *MethodHttpBinding) GetDescription() string
func (*MethodHttpBinding) GetName ¶
func (self *MethodHttpBinding) GetName() string
func (*MethodHttpBinding) SetDescription ¶
func (self *MethodHttpBinding) SetDescription(d string)
func (*MethodHttpBinding) SetName ¶
func (self *MethodHttpBinding) SetName(s string)
type MicroserviceDefinition ¶
type MicroserviceDefinition struct { Describable Name string Description string Files []*ProtoFile }
MicroserviceDefinition is the root node for any particular `Doctree`
func (*MicroserviceDefinition) Describe ¶
func (self *MicroserviceDefinition) Describe(depth int) string
func (*MicroserviceDefinition) GetByName ¶
func (self *MicroserviceDefinition) GetByName(name string) Describable
GetByName returns any ProtoFile structs it my have with a matching `Name`.
func (*MicroserviceDefinition) GetDescription ¶
func (self *MicroserviceDefinition) GetDescription() string
func (*MicroserviceDefinition) GetName ¶
func (self *MicroserviceDefinition) GetName() string
func (*MicroserviceDefinition) Markdown ¶
func (self *MicroserviceDefinition) Markdown() string
func (*MicroserviceDefinition) SetComment ¶
func (self *MicroserviceDefinition) SetComment(namepath []string, comment_body string)
SetComment changes the node at the given 'name-path' to have a description of `comment_body`. `name-path` is a series of names of describable objects each found within the previous, accessed by recursively calling `GetByName` on the result of the last call, beginning with this MicroserviceDefinition. Once the final Describable object is found, the `description` field of that struct is set to `comment_body`.
func (*MicroserviceDefinition) SetDescription ¶
func (self *MicroserviceDefinition) SetDescription(d string)
func (*MicroserviceDefinition) SetName ¶
func (self *MicroserviceDefinition) SetName(s string)
func (*MicroserviceDefinition) String ¶
func (self *MicroserviceDefinition) String() string
String kicks off the recursive call to `describe` within the tree of Describables, returning a string showing the structured view of the tree.
type ProtoEnum ¶
type ProtoEnum struct { Describable Name string Description string Values []*EnumValue }
func (*ProtoEnum) GetDescription ¶
func (*ProtoEnum) SetDescription ¶
type ProtoFile ¶
type ProtoFile struct { Describable Name string Description string Messages []*ProtoMessage Enums []*ProtoEnum Services []*ProtoService }
func (*ProtoFile) GetByName ¶
func (self *ProtoFile) GetByName(name string) Describable
func (*ProtoFile) GetDescription ¶
func (*ProtoFile) SetDescription ¶
type ProtoMessage ¶
type ProtoMessage struct { Describable Name string Description string Fields []*MessageField }
func (*ProtoMessage) Describe ¶
func (self *ProtoMessage) Describe(depth int) string
func (*ProtoMessage) GetByName ¶
func (self *ProtoMessage) GetByName(name string) Describable
func (*ProtoMessage) GetDescription ¶
func (self *ProtoMessage) GetDescription() string
func (*ProtoMessage) GetName ¶
func (self *ProtoMessage) GetName() string
func (*ProtoMessage) SetDescription ¶
func (self *ProtoMessage) SetDescription(d string)
func (*ProtoMessage) SetName ¶
func (self *ProtoMessage) SetName(s string)
type ProtoService ¶
type ProtoService struct { Describable Name string Description string Methods []*ServiceMethod FullyQualifiedName string }
func (*ProtoService) Describe ¶
func (self *ProtoService) Describe(depth int) string
func (*ProtoService) GetByName ¶
func (self *ProtoService) GetByName(name string) Describable
func (*ProtoService) GetDescription ¶
func (self *ProtoService) GetDescription() string
func (*ProtoService) GetName ¶
func (self *ProtoService) GetName() string
func (*ProtoService) SetDescription ¶
func (self *ProtoService) SetDescription(d string)
func (*ProtoService) SetName ¶
func (self *ProtoService) SetName(s string)
type ServiceMethod ¶
type ServiceMethod struct { Describable Name string Description string RequestType *ProtoMessage ResponseType *ProtoMessage HttpBindings []*MethodHttpBinding }
func (*ServiceMethod) Describe ¶
func (self *ServiceMethod) Describe(depth int) string
func (*ServiceMethod) GetByName ¶
func (self *ServiceMethod) GetByName(name string) Describable
func (*ServiceMethod) GetDescription ¶
func (self *ServiceMethod) GetDescription() string
func (*ServiceMethod) GetName ¶
func (self *ServiceMethod) GetName() string
func (*ServiceMethod) SetDescription ¶
func (self *ServiceMethod) SetDescription(d string)
func (*ServiceMethod) SetName ¶
func (self *ServiceMethod) SetName(s string)
Directories ¶
Path | Synopsis |
---|---|
Makedt is a package for exposing the creation of a doctree structure.
|
Makedt is a package for exposing the creation of a doctree structure. |
googlethirdparty
Package google_api is a generated protocol buffer package.
|
Package google_api is a generated protocol buffer package. |