gen

package
v2.1.1608 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Client = "client"
View Source
const ClientDescription = "client HTTP library"
View Source
const ClientTitle = "Client library"
View Source
const GeneratePath = "generate-path"
View Source
const GeneratePathDescription = "path to generate source code into"
View Source
const GeneratePathTitle = "Generate path"
View Source
const Jsonlib = "jsonlib"
View Source
const JsonlibDescription = "json serialization/deserialization library"
View Source
const JsonlibTitle = "JSON library"
View Source
const ModuleName = "module-name"
View Source
const ModuleNameDescription = "module name"
View Source
const ModuleNameTitle = "Module name"
View Source
const OutFile = "out-file"
View Source
const OutFileDescription = "path to output file"
View Source
const OutFileTitle = "Output file path"
View Source
const PackageName = "package-name"
View Source
const PackageNameDescription = "package name"
View Source
const PackageNameTitle = "Package name"
View Source
const Server = "server"
View Source
const ServerDescription = "server HTTP library/framework"
View Source
const ServerTitle = "Server library"
View Source
const ServicesPath = "services-path"
View Source
const ServicesPathDescription = "path to scaffold services code"
View Source
const ServicesPathTitle = "Services path"
View Source
const SpecFile = "spec-file"
View Source
const SpecFileDescription = "path to specification file"
View Source
const SpecFileTitle = "Spec file path"
View Source
const SwaggerPath = "swagger-path"
View Source
const SwaggerPathDescription = "path of generated OpenAPI (Swagger) specification file"
View Source
const SwaggerPathTitle = "Swagger path"
View Source
const Validation = "validation"
View Source
const ValidationDescription = "type validation library"
View Source
const ValidationTitle = "Type validation library"

Variables

View Source
var ClientGo = Generator{
	"client-go",
	"Go Client",
	"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 golang.GenerateClient(specification, params[ArgModuleName], params[ArgGeneratePath])
	},
}
View Source
var ClientJava = Generator{
	"client-java",
	"Java Client",
	"Generate Java client 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 java.GenerateClient(specification, params[ArgJsonlib], params[ArgPackageName], params[ArgGeneratePath])
	},
}
View Source
var ClientKotlin = Generator{
	"client-kotlin",
	"Kotlin Client",
	"Generate Kotlin client source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgJsonlib, Required: false, Values: JsonlibKotlinValues},
		{Arg: ArgPackageName, Required: false},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return kotlin.GenerateClient(specification, params[ArgJsonlib], params[ArgPackageName], params[ArgGeneratePath])
	},
}
View Source
var ClientRuby = Generator{
	"client-ruby",
	"Ruby Client",
	"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 ruby.GenerateClient(specification, params[ArgGeneratePath])
	},
}
View Source
var ClientScala = Generator{
	"client-scala",
	"Scala Client",
	"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 scala.GenerateSttpClient(specification, "", params[ArgGeneratePath])
	},
}
View Source
var ClientTs = Generator{
	"client-ts",
	"TypeScript Client",
	"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 ts.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 JsonlibKotlinValues = []string{"jackson", "moshi"}
View Source
var ModelsGo = Generator{
	"models-go",
	"Go Models",
	"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 golang.GenerateModels(specification, params[ArgModuleName], params[ArgGeneratePath])
	},
}
View Source
var ModelsJava = Generator{
	"models-java",
	"Java Models",
	"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 java.GenerateModels(specification, params[ArgJsonlib], params[ArgPackageName], params[ArgGeneratePath])
	},
}
View Source
var ModelsKotlin = Generator{
	"models-kotlin",
	"Kotlin Models",
	"Generate Kotlin models source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgJsonlib, Required: false, Values: JsonlibKotlinValues},
		{Arg: ArgPackageName, Required: false},
		{Arg: ArgGeneratePath, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		return kotlin.GenerateModels(specification, params[ArgJsonlib], params[ArgPackageName], params[ArgGeneratePath])
	},
}
View Source
var ModelsRuby = Generator{
	"models-ruby",
	"Ruby Models",
	"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 ruby.GenerateModels(specification, params[ArgGeneratePath])
	},
}
View Source
var ModelsScala = Generator{
	"models-scala",
	"Scala Models",
	"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 scala.GenerateCirceModels(specification, "", params[ArgGeneratePath])
	},
}
View Source
var ModelsTs = Generator{
	"models-ts",
	"TypeScript Models",
	"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 ts.GenerateModels(specification, params[ArgValidation], params[ArgGeneratePath])
	},
}
View Source
var Openapi = Generator{
	"openapi",
	"OpenAPI v3",
	"Generate OpenAPI specification",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgOutFile, Required: true},
	},
	func(specification *spec.Spec, params map[Arg]string) *sources.Sources {
		openapiFile := openapi.GenerateOpenapi(specification, params[ArgOutFile])
		sources := sources.NewSources()
		sources.AddGenerated(openapiFile)
		return sources
	},
}
View Source
var ServerJavaValues = []string{"spring", "micronaut"}
View Source
var ServerKotlinValues = []string{"micronaut"}
View Source
var ServerTsValues = []string{"express", "koa"}
View Source
var ServiceGo = Generator{
	"service-go",
	"Go Service",
	"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 golang.GenerateService(specification, params[ArgModuleName], params[ArgSwaggerPath], params[ArgGeneratePath], params[ArgServicesPath])
	},
}
View Source
var ServiceJava = Generator{
	"service-java",
	"Java Service",
	"Generate Java service source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgJsonlib, Required: true, Values: JsonlibJavaValues},
		{Arg: ArgServer, Required: true, Values: ServerJavaValues},
		{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 java.GenerateService(specification, params[ArgJsonlib], params[ArgServer], params[ArgPackageName], params[ArgSwaggerPath], params[ArgGeneratePath], params[ArgServicesPath])
	},
}
View Source
var ServiceKotlin = Generator{
	"service-kotlin",
	"Kotlin Service",
	"Generate Kotlin service source code",
	[]GeneratorArg{
		{Arg: ArgSpecFile, Required: true},
		{Arg: ArgJsonlib, Required: true, Values: JsonlibKotlinValues},
		{Arg: ArgServer, Required: true, Values: ServerKotlinValues},
		{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 kotlin.GenerateService(specification, params[ArgJsonlib], params[ArgServer], params[ArgPackageName], params[ArgSwaggerPath], params[ArgGeneratePath], params[ArgServicesPath])
	},
}
View Source
var ServiceScala = Generator{
	"service-scala",
	"Scala Service",
	"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 scala.GeneratePlayService(specification, params[ArgSwaggerPath], params[ArgGeneratePath], params[ArgServicesPath])
	},
}
View Source
var ServiceTs = Generator{
	"service-ts",
	"TypeScript Service",
	"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 ts.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
	Title       string
	Description string
}

type Generator added in v2.1.1192

type Generator struct {
	Name      string
	Title     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