Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseCapsule ¶
type BaseCapsule struct {
*CapsulePowder
}
BaseCapsule provides necessary data to fill the template.
func (*BaseCapsule) FormatCode ¶
func (c *BaseCapsule) FormatCode(code string) (string, error)
FormatCode formats the generated code.
type Capsule ¶
type Capsule interface { FormatCode(string) (string, error) SetData(specData *Data) SetMode(templateID string, subServiceID ...string) }
Capsule defines the common functions to implement for generator.
type CapsulePowder ¶
CapsulePowder provides necessary data to fill the template.
func (*CapsulePowder) SetData ¶
func (c *CapsulePowder) SetData(specData *Data)
SetData sets the API spec data.
func (*CapsulePowder) SetMode ¶
func (c *CapsulePowder) SetMode(templateID string, subServiceID ...string)
SetMode sets the template ID and sub service ID.
type Data ¶
type Data struct { Service *Service SubServices map[string]*SubService CustomizedTypes map[string]*Property }
Data stores the data of an API service to render.
type Operation ¶
type Operation struct { ID string Name string Description string DocumentationURL string Request *Request Responses map[int]*Response }
Operation stores the data of an operation.
type Property ¶
type Property struct { ID string Name string Description string Type string ExtraType string Format string CollectionFormat string Enum []string Default string IsRequired bool Properties map[string]*Property }
Property describes info of a property.
type Request ¶
type Request struct { Method string URI string Params *Property Headers *Property Elements *Property Body *Property }
Request stores the data of request section.
type Response ¶
type Response struct { StatusCode *StatusCode Headers *Property Elements *Property Body *Property }
Response stores the data of response section.
type Service ¶
type Service struct { APIVersion string Name string BasePath string Description string Properties *Property Operations map[string]*Operation }
Service stores the data of a service.
type StatusCode ¶
StatusCode stores the data of status code.
Click to show internal directories.
Click to hide internal directories.