config

package
v1.0.19 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	InputFolderPath string `yaml:"input_folder_path"`
	// Where to output generated code, ./generated/ is default
	OutputFile string `yaml:"output_file_path"`
	// The name of the module the generated code will be part of
	ModuleName string `yaml:"module_name"`
	// The name of the package that the GORM models are part of
	ModelsPkg string `yaml:"models_package"`
	// The name of the package that the GORM-generated Query is in
	QueryPkg string `yaml:"query_package"`
	// If true, clears the contents of the output directory before generating new files
	ClearOutputDir bool `yaml:"clear_output_dir"`
	// If true, parses classes that do not inherit from gorm.Model
	AllowCustomModels bool `yaml:"allow_custom_models"`
	// If true, deletes all model specific YAML files after combining them into a single YAML file
	PruneYaml bool `yaml:"prune_yaml"`
	// If true, the generated OpenAPI YAML file uses this as its base
	OpenApiFile string `yaml:"openapi_file"`
	// Excludes these GORM models from the generated OpenAPI routes
	ExcludeModels []string `yaml:"exclude_models,omitempty"`
	// Exclude these field names from the generated create and read endpoints
	ExcludeFields []string `yaml:"exclude_fields,omitempty"`
	// If true, generates a sample main.go file for running the server
	GenerateMain bool `yaml:"generate_main"`
	// If true, generates a server that uses all generated controllers
	GenerateServer bool `yaml:"generate_server"`
	// Override built-in templates from user-provided files
	UserTemplates map[string]string `yaml:"user_templates,omitempty"`

	// Generated Repository configuration
	RepositoryConfiguration *RepositoryConfiguration `yaml:"repository,omitempty"`

	// oapi-codegen server configuration
	ServerCodegen *OApiGenConfiguration `yaml:"server_codegen,omitempty"`
	// oapi-codegen types configuration
	TypesCodegen *OApiGenConfiguration `yaml:"types_codegen,omitempty"`
}

func FromYamlFile

func FromYamlFile(fp string) (*Config, error)

func (*Config) Validate

func (o *Config) Validate() error

type OApiGenConfiguration

type OApiGenConfiguration struct {
	codegen.Configuration `yaml:",inline"`

	// OutputFile is the filepath to output
	OutputFile string `yaml:"output,omitempty"`
}

type RepositoryConfiguration

type RepositoryConfiguration struct {
	// OutputFile is the folder to output to
	OutputFile string `yaml:"output,omitempty"`
	// Custom generated repository template
	Template *string `yaml:"template,omitempty"`
}

func (*RepositoryConfiguration) Validate

func (c *RepositoryConfiguration) Validate() error

Jump to

Keyboard shortcuts

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