generators

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2026 License: EUPL-1.2 Imports: 8 Imported by: 0

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 NewGoGenerator

func NewGoGenerator() *GoGenerator

NewGoGenerator creates a new Go generator.

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.

func (*Registry) Get

func (r *Registry) Get(lang string) (Generator, bool)

Get returns a generator by language.

func (*Registry) Languages

func (r *Registry) Languages() []string

Languages returns all registered language identifiers.

func (*Registry) Register

func (r *Registry) Register(g Generator)

Register adds a generator to the registry.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL