Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PruneTypes ¶
func PruneTypes(pkgs []*Package)
PruneTypes prunes unused types from the package by walking all endpoints. Types that are not used in requests or responses are removed.
Types ¶
type Array ¶
type Array struct { // Value is the type of the array. Value Type `json:"value"` }
Array is the documentation for an array.
func (*Array) MarshalJSON ¶
MarshalJSON marshals the array to JSON with a type field.
type Basic ¶
type Basic struct { // Name is the name of the data type. Name string `json:"name"` // Example is an example of the value of the type. Example string `json:"example"` }
Basic is the documentation for a basic type such as string or int.
func (*Basic) MarshalJSON ¶
MarshalJSON marshals the basic type to JSON with a type field.
type Endpoint ¶
type Endpoint struct { // Name is the name of the endpoint. Name string `json:"name"` // Description is the description of the endpoint. Description string `json:"description"` // Method is the HTTP method to trigger the endpoint. Method string `json:"method"` // Path is the HTTP path to trigger the endpoint. Path string `json:"path"` // BodyField is the name of the field that contains the request body. BodyField string `json:"body_field"` // Request is the data type of the request. Request Type `json:"request"` // Response is the data type of the response. Response Type `json:"response"` // StreamingRequest is true if the request is streamed. StreamingRequest bool `json:"streaming_request"` // StreamingResponse is true if the response is streamed. StreamingResponse bool `json:"streaming_response"` }
Endpoint is the documentation for an endpoint.
type Enum ¶
type Enum struct { // Name is the name of the data type. Name string `json:"name"` // Description is the description of the data type. Description string `json:"description"` // Values are the list of values for enum. Values []*EnumVal `json:"values"` }
Enum is the documentation for an enum.
func (*Enum) MarshalJSON ¶
MarshalJSON marshals the enum to JSON with a type field.
type EnumVal ¶
type EnumVal struct { // Value is the value of the enum. Value string `json:"value"` // Description is the description of the enum value. Description string `json:"description"` }
EnumVal is the documentation for enum values.
type Field ¶
type Field struct { // Name is the name of the field. Name string `json:"name"` // GunkName is the gunk name of the field. GunkName string `json:"-"` // Description is the description of the field. Description string `json:"description"` // Type is the type of the field. Type Type `json:"type"` }
Field is the documentation for a field in a message.
type Map ¶
type Map struct { // Key is the type of the map key. Key Type `json:"key"` // Value is the type of the map value. Value Type `json:"value"` }
Map is the documentation for a map.
func (*Map) MarshalJSON ¶
MarshalJSON marshals the map to JSON with a type field.
type Message ¶
type Message struct { // Name is the name of the data type. Name string `json:"name"` // Description is the description of the data type. Description string `json:"description"` // Fields is a list of fields in the data type. Fields []*Field `json:"fields"` }
Message is the documentation for a message.
func (*Message) MarshalJSON ¶
MarshalJSON marshals the message to JSON with a type field.
type NamedType ¶
NamedType is a data type that is named and not purely derived from other data types. Arrays and maps are not NamedTypes.
type Package ¶
type Package struct { // Name is the name of the package. It may not necessarily be unique. Name string `json:"name"` // ID is the full qualified path of the package and can serve as a unique // identifier. ID string `json:"id"` // Description is the description of the comment. Description string `json:"description"` // Services is a list of services in the package. Services []*Service `json:"services"` // Types is a list of data types in the package. Types map[string]Type `json:"types"` }
Package is the documentation for a package.
type Ref ¶
type Ref struct { // Name is the fully qualified name of the referenced type. Name string `json:"name"` }
Ref is a reference to a Message or Enum type.
func (*Ref) MarshalJSON ¶
MarshalJSON marshals the enum to JSON with a type field.
type Service ¶
type Service struct { // Name is the name of the service. Name string `json:"name"` // Description is the description of the service. Description string `json:"description"` // Methods is a list of methods in the service. Endpoints []*Endpoint `json:"endpoints"` }
Service is the documentation for a service.
type Tag ¶
type Tag struct { // Name is the name of the tag. Name string `json:"name"` // Preamble is the preamble for this tag. Preamble string `json:"preamble"` // Weight is the weight of the tag, used for sorting. Weight int `json:"weight"` // Packages is the list of packages for this tag. Packages []*Package `json:"packages"` }
Tag contains the packages for a specific tag, as well as the preamble information.