appconf

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFileName = "primelib.yaml"

ConfigFileName is the default name of the configuration file

Variables

This section is empty.

Functions

This section is empty.

Types

type CSharpLanguageOptions

type CSharpLanguageOptions struct {
	Enabled     bool     `yaml:"enabled"`
	IgnoreFiles []string `yaml:"ignoreFiles"`
}

type Configuration

type Configuration struct {
	Output       string `yaml:"output,omitempty" jsonschema_description:"output directory for the generated code"`
	OutputSubDir bool   `yaml:"outputSubDir,omitempty" jsonschema_description:"create a subdirectory for each generator in the output directory"`

	Repository  RepositoryConf   `yaml:"repository"`
	Maintainers []MaintainerConf `yaml:"maintainers"`
	Provider    ProviderConf     `yaml:"provider"`

	Generators []GeneratorConf `yaml:"generators"` // Generators can be used to fully customize the generation process
	Presets    PresetConf      `yaml:"presets"`    // Presets are pre-configured generators for specific languages

	Spec Spec `yaml:"spec"`
}

func LoadConfig

func LoadConfig(content string) (Configuration, error)

func (Configuration) HasGenerator

func (c Configuration) HasGenerator() bool

func (Configuration) MultiLanguage

func (c Configuration) MultiLanguage() bool

type GeneratorArgs

type GeneratorArgs struct {
	// UserArgs are the arguments that are passed to the generator
	OpenAPIGeneratorArgs []string `yaml:"openapi_generator"`
}

type GeneratorConf

type GeneratorConf struct {
	Enabled   bool                   `yaml:"enabled"`   // Enable the generator
	Name      string                 `yaml:"name"`      // Name of the generator
	Type      GeneratorType          `yaml:"type"`      // Type of the generator
	Arguments []string               `yaml:"arguments"` // Arguments that are passed to the generator command
	Config    map[string]interface{} `yaml:"config"`    // Config that is passed to the generator
}

type GeneratorConfig

type GeneratorConfig struct {
	GeneratorName         string                 `json:"generatorName" yaml:"generatorName"`
	InvokerPackage        string                 `json:"invokerPackage" yaml:"invokerPackage"`
	ApiPackage            string                 `json:"apiPackage" yaml:"apiPackage"`
	ModelPackage          string                 `json:"modelPackage" yaml:"modelPackage"`
	EnablePostProcessFile bool                   `json:"enablePostProcessFile" yaml:"enablePostProcessFile"`
	GlobalProperty        map[string]interface{} `json:"globalProperty" yaml:"globalProperty"`
	AdditionalProperties  map[string]interface{} `json:"additionalProperties" yaml:"additionalProperties"`
}

type GeneratorType

type GeneratorType string
const (
	GeneratorTypeOpenApiGenerator GeneratorType = "openapi-generator"
	GeneratorTypePrimeCodeGen     GeneratorType = "primecodegen"
	GeneratorTypeSpeakEasy        GeneratorType = "speakeasy"
	GeneratorTypePrintingPress    GeneratorType = "printing-press"
)

type GoLanguageOptions

type GoLanguageOptions struct {
	Enabled     bool     `yaml:"enabled"`
	IgnoreFiles []string `yaml:"ignoreFiles"`

	ModuleName string `yaml:"module"`
}

type JavaLanguageOptions

type JavaLanguageOptions struct {
	Enabled     bool     `yaml:"enabled"`
	IgnoreFiles []string `yaml:"ignoreFiles"`

	GroupId    string `yaml:"groupId"`
	ArtifactId string `yaml:"artifactId"`
}

type KotlinLanguageOptions

type KotlinLanguageOptions struct {
	Enabled     bool     `yaml:"enabled"`
	IgnoreFiles []string `yaml:"ignoreFiles"`

	GroupId    string `yaml:"groupId"`
	ArtifactId string `yaml:"artifactId"`
}

type KrakenDOptions

type KrakenDOptions struct {
	Enabled     bool     `yaml:"enabled"`
	IgnoreFiles []string `yaml:"ignoreFiles"`
}

type LLMsOptions

type LLMsOptions struct {
	Enabled     bool     `yaml:"enabled"`
	IgnoreFiles []string `yaml:"ignoreFiles"`
}
type Link struct {
	Name string `yaml:"name"`
	URL  string `yaml:"url"`
}

type MaintainerConf

type MaintainerConf struct {
	ID    string `yaml:"id"`
	Name  string `yaml:"name"`
	Email string `yaml:"email"`
	URL   string `yaml:"url"`
}

type OpenApiGeneratorOptions

type OpenApiGeneratorOptions struct {
	Enabled     bool     `yaml:"enabled"`
	IgnoreFiles []string `yaml:"ignoreFiles"`
}

type PresetConf

type PresetConf struct {
	Scaffolding   ScaffoldingOptions        `yaml:"scaffolding"`
	Go            GoLanguageOptions         `yaml:"go"`
	Java          JavaLanguageOptions       `yaml:"java"`
	Kotlin        KotlinLanguageOptions     `yaml:"kotlin"`
	Python        PythonLanguageOptions     `yaml:"python"`
	CSharp        CSharpLanguageOptions     `yaml:"csharp"`
	Typescript    TypescriptLanguageOptions `yaml:"typescript"`
	KrakenD       KrakenDOptions            `yaml:"krakend"`
	PrintingPress PrintingPressOptions      `yaml:"printingpress"`
	LLMs          LLMsOptions               `yaml:"llms"`
}

PresetConf are pre-configured generators for specific languages

func (PresetConf) EnabledCount

func (c PresetConf) EnabledCount() int

type PrimeCodeGenOptions

type PrimeCodeGenOptions struct {
	Enabled     bool     `yaml:"enabled"`
	IgnoreFiles []string `yaml:"ignoreFiles"`
}

type PrintingPressOptions

type PrintingPressOptions struct {
	Enabled     bool     `yaml:"enabled"`
	IgnoreFiles []string `yaml:"ignoreFiles"`
}

type ProviderConf

type ProviderConf struct {
	ProductDescription string      `yaml:"productDescription"`
	Organizations      []string    `yaml:"organizations"`
	Trademarks         []Trademark `yaml:"trademarks"`
	Documentation      []Link      `yaml:"documentation"`
	Specifications     []Link      `yaml:"specifications"`
}

type PythonLanguageOptions

type PythonLanguageOptions struct {
	Enabled     bool     `yaml:"enabled"`
	IgnoreFiles []string `yaml:"ignoreFiles"`

	PypiPackageName string `yaml:"pypiPackageName"`
}

type RepositoryConf

type RepositoryConf struct {
	Name          string `yaml:"name"`
	Title         string `yaml:"title"`
	Description   string `yaml:"description"`
	URL           string `yaml:"url"`
	InceptionYear int    `yaml:"inceptionYear"`
	LicenseName   string `yaml:"licenseName"`
	LicenseURL    string `yaml:"licenseURL"`
}

type ScaffoldingOptions

type ScaffoldingOptions struct {
	Enabled     bool     `yaml:"enabled"`
	IgnoreFiles []string `yaml:"ignoreFiles"`
}

type Spec

type Spec struct {
	// File is the path to the openapi specification file
	File string `yaml:"file" default:"openapi.yaml" required:"true"`
	// SourcesDir is the directory where specifications are stored
	SourcesDir string `yaml:"sourcesDir"`
	// Sources contains one or multiple sources to specifications
	Sources []SpecSource `yaml:"sources" required:"true"`
	// Type is the format of the api specification
	Type openapidocument.SpecType `yaml:"type" required:"true"`
	// InputPatches are applied to the source specifications before merging
	InputPatches []sharedpatch.SpecPatch `yaml:"inputPatches"`
	// PatchSets are the named patch sets that are applied to the specification
	PatchSets []openapipatch.PatchSet `yaml:"patchSets"`
	// Patches are the patches that are applied to the specification
	Patches []sharedpatch.SpecPatch `yaml:"patches"`
}

func (Spec) GetSourcesDir

func (s Spec) GetSourcesDir(rootDir string) string

func (Spec) UrlSlice

func (s Spec) UrlSlice() []string

type SpecSource

type SpecSource struct {
	File    string                     `yaml:"file"` // File path to the openapi specification
	URL     string                     `yaml:"url"`  // URL to the openapi specification
	Format  openapidocument.SourceType `yaml:"format" default:"spec"`
	Type    openapidocument.SpecType   `yaml:"type"`
	Patches []sharedpatch.SpecPatch    `yaml:"patches"` // Patches are the patches that are applied to the specification
}

type Trademark

type Trademark struct {
	Name  string
	Owner string
}

type TypescriptLanguageOptions

type TypescriptLanguageOptions struct {
	Enabled     bool     `yaml:"enabled"`
	IgnoreFiles []string `yaml:"ignoreFiles"`

	NpmOrg  string `yaml:"npmOrg"`
	NpmName string `yaml:"npmName"`
}

Jump to

Keyboard shortcuts

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