gen

package
v2.1.1252 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Client = "client"
View Source
const ClientDescription = "client HTTP library"
View Source
const GeneratePath = "generate-path"
View Source
const GeneratePathDescription = "path to generate source code into"
View Source
const Jsonlib = "jsonlib"
View Source
const JsonlibDescription = "json serialization/deserialization library"
View Source
const ModuleName = "module-name"
View Source
const ModuleNameDescription = "module name"
View Source
const PackageName = "package-name"
View Source
const PackageNameDescription = "package name"
View Source
const Server = "server"
View Source
const ServerDescription = "server HTTP library/framework"
View Source
const ServicesPath = "services-path"
View Source
const ServicesPathDescription = "path to scaffold services code"
View Source
const SpecFile = "spec-file"
View Source
const SpecFileDescription = "path to specification file"
View Source
const SwaggerPath = "swagger-path"
View Source
const SwaggerPathDescription = "path of generated OpenAPI (Swagger) specification file"
View Source
const Validation = "validation"
View Source
const ValidationDescription = "type validation library"

Variables

View Source
var ClientGo = Generator{
	"client-go",
	"Generate Go client source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgModuleName, Required: true},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return gengo.GenerateClient(specification, params[ArgModuleName], params[ArgGeneratePath])
	},
}
View Source
var ClientJava = Generator{
	"client-java",
	"Generate Java client source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgJsonlib, Required: true, Values: JsonlibJavaValues},
		{Arg: ArgPackageName, Required: true},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return genjava.GenerateClient(specification, params[ArgJsonlib], params[ArgPackageName], params[ArgGeneratePath])
	},
}
View Source
var ClientKotlin = Generator{
	"client-kotlin",
	"Generate Kotlin client source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgPackageName, Required: true},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return genkotlin.GenerateClient(specification, params[ArgPackageName], params[ArgGeneratePath])
	},
}
View Source
var ClientRuby = Generator{
	"client-ruby",
	"Generate Ruby client source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return genruby.GenerateClient(specification, params[ArgGeneratePath])
	},
}
View Source
var ClientScala = Generator{
	"client-scala",
	"Generate Scala client source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return genscala.GenerateSttpClient(specification, "", params[ArgGeneratePath])
	},
}
View Source
var ClientTs = Generator{
	"client-ts",
	"Generate TypeScript client source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgClient, Required: true, Values: ClientTsValues},
		{Arg: ArgValidation, Required: true, Values: ValidationTsValues},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return gents.GenerateClient(specification, params[ArgGeneratePath], params[ArgClient], params[ArgValidation])
	},
}
View Source
var ClientTsValues = []string{"axios", "node-fetch", "browser-fetch"}
View Source
var JsonlibJavaValues = []string{"jackson", "moshi"}
View Source
var ModelsGo = Generator{
	"models-go",
	"Generate Go models source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgModuleName, Required: true},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return gengo.GenerateModels(specification, params[ArgModuleName], params[ArgGeneratePath])
	},
}
View Source
var ModelsJava = Generator{
	"models-java",
	"Generate Java models source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgJsonlib, Required: true, Values: JsonlibJavaValues},
		{Arg: ArgPackageName, Required: false},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return genjava.GenerateModels(specification, params[ArgJsonlib], params[ArgPackageName], params[ArgGeneratePath])
	},
}
View Source
var ModelsKotlin = Generator{
	"models-kotlin",
	"Generate Kotlin models source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgJsonlib, Required: false, Default: "jackson"},
		{Arg: ArgPackageName, Required: false},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return genkotlin.GenerateModels(specification, params[ArgPackageName], params[ArgGeneratePath])
	},
}
View Source
var ModelsRuby = Generator{
	"models-ruby",
	"Generate Ruby models source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return genruby.GenerateModels(specification, params[ArgGeneratePath])
	},
}
View Source
var ModelsScala = Generator{
	"models-scala",
	"Generate Scala models source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return genscala.GenerateCirceModels(specification, "", params[ArgGeneratePath])
	},
}
View Source
var ModelsTs = Generator{
	"models-ts",
	"Generate TypeScript models source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgValidation, Required: true, Values: ValidationTsValues},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return gents.GenerateModels(specification, params[ArgValidation], params[ArgGeneratePath])
	},
}
View Source
var ServerTsValues = []string{"express", "koa"}
View Source
var ServiceGo = Generator{
	"service-go",
	"Generate Go service source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgModuleName, Required: true},
		{Arg: ArgSwaggerPath, Required: false},
		{Arg: ArgGeneratePath, Required: true},
		{Arg: ArgServicesPath, Required: false},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return gengo.GenerateService(specification, params[ArgModuleName], params[ArgSwaggerPath], params[ArgGeneratePath], params[ArgServicesPath])
	},
}
View Source
var ServiceJava = Generator{
	"service-java",
	"Generate Java service source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgJsonlib, Required: true, Values: JsonlibJavaValues},
		{Arg: ArgPackageName, Required: false},
		{Arg: ArgSwaggerPath, Required: false},
		{Arg: ArgGeneratePath, Required: true},
		{Arg: ArgServicesPath, Required: false},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return genjava.GenerateService(specification, params[ArgJsonlib], params[ArgPackageName], params[ArgSwaggerPath], params[ArgGeneratePath], params[ArgServicesPath])
	},
}
View Source
var ServiceScala = Generator{
	"service-scala",
	"Generate Scala service source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgSwaggerPath, Required: false},
		{Arg: ArgGeneratePath, Required: true},
		{Arg: ArgServicesPath, Required: false},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return genscala.GeneratePlayService(specification, params[ArgSwaggerPath], params[ArgGeneratePath], params[ArgServicesPath])
	},
}
View Source
var ServiceTs = Generator{
	"service-ts",
	"Generate TypeScript client source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgServer, Required: true, Values: ServerTsValues},
		{Arg: ArgValidation, Required: true, Values: ValidationTsValues},
		{Arg: ArgGeneratePath, Required: true},
		{Arg: ArgServicesPath, Required: false},
		{Arg: ArgSwaggerPath, Required: false},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return gents.GenerateService(specification, params[ArgSwaggerPath], params[ArgGeneratePath], params[ArgServicesPath], params[ArgServer], params[ArgValidation])
	},
}
View Source
var ValidationTsValues = []string{"superstruct", "io-ts"}

Functions

This section is empty.

Types

type Arg added in v2.1.1192

type Arg struct {
	Name        string
	Description string
}

type Generator added in v2.1.1192

type Generator struct {
	Name      string
	Usage     string
	Args      []GeneratorArg
	Generator GeneratorFunc
}

type GeneratorArg added in v2.1.1192

type GeneratorArg struct {
	Arg
	Values   []string
	Required bool
	Default  string
}

type GeneratorFunc added in v2.1.1192

type GeneratorFunc func(specification *spec.Spec, params map[Arg]string) *sources.Sources

Jump to

Keyboard shortcuts

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