Documentation ¶
Index ¶
- func VendorImportsFromContext(ctx context.Context) map[string]bool
- func WithGenOption(ctx context.Context, simpleDict GenOption) context.Context
- func WithVendorImports(ctx context.Context, vendorImports map[string]bool) context.Context
- type ClientGenerator
- type GenOption
- type GenOptionFn
- type OperationGenerator
- func (g *OperationGenerator) ID(id string) string
- func (g *OperationGenerator) ParamField(ctx context.Context, parameter *oas.Parameter) *codegen.SnippetField
- func (g *OperationGenerator) RequestBodyField(ctx context.Context, requestBody *oas.RequestBody) *codegen.SnippetField
- func (g *OperationGenerator) ResponseType(ctx context.Context, responses *oas.Responses) (codegen.SnippetType, []string)
- func (g *OperationGenerator) Scan(ctx context.Context, openapi *oas.OpenAPI)
- func (g *OperationGenerator) WriteOperation(ctx context.Context, method string, path string, operation *oas.Operation)
- type ServiceClientGenerator
- func (g *ServiceClientGenerator) ClientInstanceName() string
- func (g *ServiceClientGenerator) ClientInterfaceName() string
- func (g *ServiceClientGenerator) OperationMethod(ctx context.Context, operation *oas.Operation, asInterface bool) codegen.Snippet
- func (g *ServiceClientGenerator) OperationMethodSimplify(ctx context.Context, operation *oas.Operation, asInterface bool) codegen.Snippet
- func (g *ServiceClientGenerator) Scan(ctx context.Context, openapi *oas.OpenAPI)
- func (g *ServiceClientGenerator) ScanSimplifyV1(ctx context.Context, openapi *oas.OpenAPI)
- func (g *ServiceClientGenerator) ScanSimplifyV2(ctx context.Context, openapi *oas.OpenAPI)
- func (g *ServiceClientGenerator) WriteClient()
- func (g *ServiceClientGenerator) WriteClientImplSimplifyV1(ctx context.Context)
- func (g *ServiceClientGenerator) WriteClientImplSimplifyV2(ctx context.Context)
- func (g *ServiceClientGenerator) WriteClientInterface(ctx context.Context, openapi *oas.OpenAPI)
- func (g *ServiceClientGenerator) WriteClientSimplify(ctx context.Context, openapi *oas.OpenAPI)
- type SimplifyDict
- type TypeGenerator
- func (g *TypeGenerator) BasicType(schemaType string, format string) codegen.SnippetType
- func (g *TypeGenerator) FieldOf(ctx context.Context, name string, propSchema *oas.Schema, ...) *codegen.SnippetField
- func (g *TypeGenerator) FieldsFrom(ctx context.Context, schema *oas.Schema) (fields []*codegen.SnippetField)
- func (g *TypeGenerator) Scan(ctx context.Context, openapi *oas.OpenAPI)
- func (g *TypeGenerator) Type(ctx context.Context, schema *oas.Schema) (codegen.SnippetType, bool)
- func (g *TypeGenerator) TypeIndirect(ctx context.Context, schema *oas.Schema) (codegen.SnippetType, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientGenerator ¶
type ClientGenerator struct { ServiceName string URL *url.URL GenOption // contains filtered or unexported fields }
func NewClientGenerator ¶
func NewClientGenerator(serviceName string, u *url.URL, opts ...GenOptionFn) *ClientGenerator
func (*ClientGenerator) Load ¶
func (g *ClientGenerator) Load()
func (*ClientGenerator) Output ¶
func (g *ClientGenerator) Output(cwd string)
type GenOption ¶
type GenOption struct { VendorImportByGoMod bool `name:"vendor-import-by-go-mod" usage:"when enable vendor only import pkg exists in go mod"` Version string `name:"version" usage:"version"` DefaultEndpoint string `name:"default-endpoint" usage:"default endpoint"` MetricSource string `name:"metric-source" usage:"metric source"` MetricTarget string `name:"metric-target" usage:"metric target"` }
func GenOptionFromContext ¶
type GenOptionFn ¶
type GenOptionFn = func(o *GenOption)
func OptionDefaultEndpoint ¶
func OptionDefaultEndpoint(defaultEndpoint string) GenOptionFn
func OptionMetricSource ¶
func OptionMetricSource(metricSource string) GenOptionFn
func OptionMetricTarget ¶
func OptionMetricTarget(metricTarget string) GenOptionFn
func OptionVendorImportByGoMod ¶
func OptionVendorImportByGoMod() GenOptionFn
func OptionVersion ¶
func OptionVersion(version string) GenOptionFn
type OperationGenerator ¶
func NewOperationGenerator ¶
func NewOperationGenerator(serviceName string, file *codegen.File) *OperationGenerator
func (*OperationGenerator) ID ¶
func (g *OperationGenerator) ID(id string) string
func (*OperationGenerator) ParamField ¶
func (g *OperationGenerator) ParamField(ctx context.Context, parameter *oas.Parameter) *codegen.SnippetField
func (*OperationGenerator) RequestBodyField ¶
func (g *OperationGenerator) RequestBodyField(ctx context.Context, requestBody *oas.RequestBody) *codegen.SnippetField
func (*OperationGenerator) ResponseType ¶
func (g *OperationGenerator) ResponseType(ctx context.Context, responses *oas.Responses) (codegen.SnippetType, []string)
func (*OperationGenerator) Scan ¶
func (g *OperationGenerator) Scan(ctx context.Context, openapi *oas.OpenAPI)
func (*OperationGenerator) WriteOperation ¶
type ServiceClientGenerator ¶
func NewServiceClientGenerator ¶
func NewServiceClientGenerator(serviceName string, file *codegen.File) *ServiceClientGenerator
func (*ServiceClientGenerator) ClientInstanceName ¶
func (g *ServiceClientGenerator) ClientInstanceName() string
func (*ServiceClientGenerator) ClientInterfaceName ¶
func (g *ServiceClientGenerator) ClientInterfaceName() string
func (*ServiceClientGenerator) OperationMethod ¶
func (*ServiceClientGenerator) OperationMethodSimplify ¶
func (*ServiceClientGenerator) Scan ¶
func (g *ServiceClientGenerator) Scan(ctx context.Context, openapi *oas.OpenAPI)
func (*ServiceClientGenerator) ScanSimplifyV1 ¶
func (g *ServiceClientGenerator) ScanSimplifyV1(ctx context.Context, openapi *oas.OpenAPI)
func (*ServiceClientGenerator) ScanSimplifyV2 ¶
func (g *ServiceClientGenerator) ScanSimplifyV2(ctx context.Context, openapi *oas.OpenAPI)
func (*ServiceClientGenerator) WriteClient ¶
func (g *ServiceClientGenerator) WriteClient()
func (*ServiceClientGenerator) WriteClientImplSimplifyV1 ¶
func (g *ServiceClientGenerator) WriteClientImplSimplifyV1(ctx context.Context)
func (*ServiceClientGenerator) WriteClientImplSimplifyV2 ¶
func (g *ServiceClientGenerator) WriteClientImplSimplifyV2(ctx context.Context)
func (*ServiceClientGenerator) WriteClientInterface ¶
func (g *ServiceClientGenerator) WriteClientInterface(ctx context.Context, openapi *oas.OpenAPI)
func (*ServiceClientGenerator) WriteClientSimplify ¶
func (g *ServiceClientGenerator) WriteClientSimplify(ctx context.Context, openapi *oas.OpenAPI)
type SimplifyDict ¶
type TypeGenerator ¶
type TypeGenerator struct { ServiceName string File *codegen.File Enums map[string]scanner.Options }
func NewTypeGenerator ¶
func NewTypeGenerator(serviceName string, file *codegen.File) *TypeGenerator
func (*TypeGenerator) BasicType ¶
func (g *TypeGenerator) BasicType(schemaType string, format string) codegen.SnippetType
func (*TypeGenerator) FieldOf ¶
func (g *TypeGenerator) FieldOf(ctx context.Context, name string, propSchema *oas.Schema, requiredFields map[string]bool) *codegen.SnippetField
func (*TypeGenerator) FieldsFrom ¶
func (g *TypeGenerator) FieldsFrom(ctx context.Context, schema *oas.Schema) (fields []*codegen.SnippetField)
func (*TypeGenerator) Scan ¶
func (g *TypeGenerator) Scan(ctx context.Context, openapi *oas.OpenAPI)
func (*TypeGenerator) Type ¶
func (g *TypeGenerator) Type(ctx context.Context, schema *oas.Schema) (codegen.SnippetType, bool)
func (*TypeGenerator) TypeIndirect ¶
func (g *TypeGenerator) TypeIndirect(ctx context.Context, schema *oas.Schema) (codegen.SnippetType, bool)
Click to show internal directories.
Click to hide internal directories.