Documentation
¶
Overview ¶
Package generators provides SDK code generators for different languages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator interface {
// Language returns the generator's target language identifier.
Language() string
// Generate creates SDK from OpenAPI spec.
Generate(ctx context.Context, opts Options) error
// Available checks if generator dependencies are installed.
Available() bool
// Install returns instructions for installing the generator.
Install() string
}
Generator defines the interface for SDK generators.
type GoGenerator ¶
type GoGenerator struct{}
GoGenerator generates Go SDKs from OpenAPI specs.
func (*GoGenerator) Available ¶
func (g *GoGenerator) Available() bool
Available checks if generator dependencies are installed.
func (*GoGenerator) Generate ¶
func (g *GoGenerator) Generate(ctx context.Context, opts Options) error
Generate creates SDK from OpenAPI spec.
func (*GoGenerator) Install ¶
func (g *GoGenerator) Install() string
Install returns instructions for installing the generator.
func (*GoGenerator) Language ¶
func (g *GoGenerator) Language() string
Language returns the generator's target language identifier.
type Options ¶
type Options struct {
// SpecPath is the path to the OpenAPI spec file.
SpecPath string
// OutputDir is where to write the generated SDK.
OutputDir string
// PackageName is the package/module name.
PackageName string
// Version is the SDK version.
Version string
}
Options holds common generation options.
type PHPGenerator ¶
type PHPGenerator struct{}
PHPGenerator generates PHP SDKs from OpenAPI specs.
func NewPHPGenerator ¶
func NewPHPGenerator() *PHPGenerator
NewPHPGenerator creates a new PHP generator.
func (*PHPGenerator) Available ¶
func (g *PHPGenerator) Available() bool
Available checks if generator dependencies are installed.
func (*PHPGenerator) Generate ¶
func (g *PHPGenerator) Generate(ctx context.Context, opts Options) error
Generate creates SDK from OpenAPI spec.
func (*PHPGenerator) Install ¶
func (g *PHPGenerator) Install() string
Install returns instructions for installing the generator.
func (*PHPGenerator) Language ¶
func (g *PHPGenerator) Language() string
Language returns the generator's target language identifier.
type PythonGenerator ¶
type PythonGenerator struct{}
PythonGenerator generates Python SDKs from OpenAPI specs.
func NewPythonGenerator ¶
func NewPythonGenerator() *PythonGenerator
NewPythonGenerator creates a new Python generator.
func (*PythonGenerator) Available ¶
func (g *PythonGenerator) Available() bool
Available checks if generator dependencies are installed.
func (*PythonGenerator) Generate ¶
func (g *PythonGenerator) Generate(ctx context.Context, opts Options) error
Generate creates SDK from OpenAPI spec.
func (*PythonGenerator) Install ¶
func (g *PythonGenerator) Install() string
Install returns instructions for installing the generator.
func (*PythonGenerator) Language ¶
func (g *PythonGenerator) Language() string
Language returns the generator's target language identifier.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds available generators.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a registry with all available generators.
type TypeScriptGenerator ¶
type TypeScriptGenerator struct{}
TypeScriptGenerator generates TypeScript SDKs from OpenAPI specs.
func NewTypeScriptGenerator ¶
func NewTypeScriptGenerator() *TypeScriptGenerator
NewTypeScriptGenerator creates a new TypeScript generator.
func (*TypeScriptGenerator) Available ¶
func (g *TypeScriptGenerator) Available() bool
Available checks if generator dependencies are installed.
func (*TypeScriptGenerator) Generate ¶
func (g *TypeScriptGenerator) Generate(ctx context.Context, opts Options) error
Generate creates SDK from OpenAPI spec.
func (*TypeScriptGenerator) Install ¶
func (g *TypeScriptGenerator) Install() string
Install returns instructions for installing the generator.
func (*TypeScriptGenerator) Language ¶
func (g *TypeScriptGenerator) Language() string
Language returns the generator's target language identifier.