Documentation
¶
Index ¶
- Variables
- func Capitalize(s string) string
- func GenerateClient(router *vel.Router, w io.Writer, config ClientGeneratorConfig) error
- func GenerateClientToFile(router *vel.Router, config ClientGeneratorConfig) error
- func GenerateOpenAPI(router *vel.Router, w io.Writer, title, version string) error
- func GenerateOpenAPIToFile(router *vel.Router, outputPath, title, version string) error
- func RegisterTemplate(name string, tpl *template.Template)
- type ApiClientDesc
- type ApiDesc
- type ClientDesc
- type ClientGen
- type ClientGeneratorConfig
- type DataType
- type Field
- type OpenAPIComponents
- type OpenAPIContent
- type OpenAPIHeader
- type OpenAPIInfo
- type OpenAPIMediaType
- type OpenAPIOperation
- type OpenAPIParameter
- type OpenAPIPathItem
- type OpenAPIRequestBody
- type OpenAPIResponse
- type OpenAPISchema
- type OpenAPISpec
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorInlineStructForbidden = errors.New("inlined structs are forbidden to use, declare an explicit type")
Functions ¶
func Capitalize ¶
func GenerateClient ¶
GenerateClient generates an API client and writes it to the provided writer
func GenerateClientToFile ¶
func GenerateClientToFile(router *vel.Router, config ClientGeneratorConfig) error
GenerateClientToFile generates an API client and writes it to a file
func GenerateOpenAPI ¶
func GenerateOpenAPIToFile ¶
GenerateOpenAPIToFile generates an OpenAPI specification and writes it to a file
func RegisterTemplate ¶
Types ¶
type ApiClientDesc ¶
type ApiClientDesc struct {
Client ClientDesc
Apis []ApiDesc
}
type ClientDesc ¶
type ClientGen ¶
type ClientGen struct {
// contains filtered or unexported fields
}
ClientGen defines api client generator it doesn't support the following: - anonymous nested struct
func New ¶
func New(clientDesc ClientDesc, meta []vel.HandlerMeta) (*ClientGen, error)
func (*ClientGen) GenerateOpenAPI ¶
func (g *ClientGen) GenerateOpenAPI(title, version string) (*OpenAPISpec, error)
GenerateOpenAPI generates an OpenAPI specification from the client metadata
type ClientGeneratorConfig ¶
type ClientGeneratorConfig struct {
TypeName string
PackageName string
OutputDir string
Language string // "go" or "ts"
PostProcess string // e.g., "goimports" or "prettier"
}
ClientGeneratorConfig holds configuration for generating API clients
type OpenAPIComponents ¶
type OpenAPIComponents struct {
Schemas map[string]*OpenAPISchema `yaml:"schemas"`
}
type OpenAPIContent ¶
type OpenAPIContent struct {
ApplicationJSON *OpenAPIMediaType `yaml:"application/json,omitempty"`
}
type OpenAPIHeader ¶
type OpenAPIHeader struct {
Description string `yaml:"description,omitempty"`
Required bool `yaml:"required,omitempty"`
Schema *OpenAPISchema `yaml:"schema"`
}
type OpenAPIInfo ¶
OpenAPI structures for generating OpenAPI specs
type OpenAPIMediaType ¶
type OpenAPIMediaType struct {
Schema *OpenAPISchema `yaml:"schema"`
}
type OpenAPIOperation ¶
type OpenAPIOperation struct {
OperationID string `yaml:"operationId"`
Description string `yaml:"description,omitempty"`
Parameters []*OpenAPIParameter `yaml:"parameters,omitempty"`
RequestBody *OpenAPIRequestBody `yaml:"requestBody,omitempty"`
Responses map[string]*OpenAPIResponse `yaml:"responses"`
}
type OpenAPIParameter ¶
type OpenAPIParameter struct {
Name string `yaml:"name"`
In string `yaml:"in"`
Description string `yaml:"description,omitempty"`
Required bool `yaml:"required"`
Schema *OpenAPISchema `yaml:"schema"`
Example interface{} `yaml:"example,omitempty"`
}
type OpenAPIPathItem ¶
type OpenAPIPathItem struct {
Get *OpenAPIOperation `yaml:"get,omitempty"`
Post *OpenAPIOperation `yaml:"post,omitempty"`
}
type OpenAPIRequestBody ¶
type OpenAPIRequestBody struct {
Content *OpenAPIContent `yaml:"content"`
}
type OpenAPIResponse ¶
type OpenAPIResponse struct {
Description string `yaml:"description"`
Content *OpenAPIContent `yaml:"content,omitempty"`
Headers map[string]*OpenAPIHeader `yaml:"headers,omitempty"`
}
type OpenAPISchema ¶
type OpenAPISchema struct {
Type string `yaml:"type,omitempty"`
Properties map[string]*OpenAPISchema `yaml:"properties,omitempty"`
Items *OpenAPISchema `yaml:"items,omitempty"`
AdditionalProperties *OpenAPISchema `yaml:"additionalProperties,omitempty"`
Required []string `yaml:"required,omitempty"`
Ref string `yaml:"$ref,omitempty"`
Format string `yaml:"format,omitempty"`
MinLength *int `yaml:"minLength,omitempty"`
MaxLength *int `yaml:"maxLength,omitempty"`
Description string `yaml:"description,omitempty"`
Minimum *int `yaml:"minimum,omitempty"`
Maximum *int `yaml:"maximum,omitempty"`
Enum []string `yaml:"enum,omitempty"`
Example interface{} `yaml:"example,omitempty"`
}
type OpenAPISpec ¶
type OpenAPISpec struct {
OpenAPI string `yaml:"openapi"`
Info *OpenAPIInfo `yaml:"info"`
Paths map[string]*OpenAPIPathItem `yaml:"paths"`
Components *OpenAPIComponents `yaml:"components"`
}
Click to show internal directories.
Click to hide internal directories.