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) SetVersioning(isEnabled bool) SetMode(templateID string, subServiceID ...string) }
Capsule defines the common functions to implement for generator.
type CapsulePowder ¶
type CapsulePowder struct { Data *Data IsVersioningEnabled bool CurrentTemplateID string CurrentSubServiceID string }
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.
func (*CapsulePowder) SetVersioning ¶
func (c *CapsulePowder) SetVersioning(isEnabled bool)
SetVersioning sets the versioning bool.
type CustomizedType ¶
CustomizedType stores the data of a CustomizedType.
type Data ¶
type Data struct { Service *Service SubServices map[string]*SubService CustomizedTypes map[string]*CustomizedType }
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 Response *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 Enum []string Default string IsRequired bool }
Property describes info of a property.
type Request ¶
type Request struct { Method string URI string Params *CustomizedType Headers *CustomizedType Elements *CustomizedType Body *Property }
Request stores the data of request section.
type Response ¶
type Response struct { StatusCodes map[int]*StatusCode Headers *CustomizedType Elements *CustomizedType Body *Property }
Response stores the data of response section.
type Service ¶
type Service struct { APIVersion string Name string Description string Properties *CustomizedType Operations map[string]*Operation }
Service stores the data of a service.
type StatusCode ¶
type StatusCode struct {
Description string
}
StatusCode stores the data of status code.
type SubService ¶
type SubService struct { ID string Name string Properties *CustomizedType Operations map[string]*Operation }
SubService stores the data of an sub service.