diff --git a/.golangci.yml b/.golangci.yml index 38850f4..1bdede5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,6 +3,7 @@ version: "2" linters: default: all disable: + - lll - exhaustruct - wrapcheck - wsl @@ -53,7 +54,9 @@ formatters: - goimports - golines # Formatters settings. - settings: {} + settings: + golines: + reformat-tags: false exclusions: # Mode of the generated files analysis. # diff --git a/any.go b/any.go index d9de581..f317c9f 100644 --- a/any.go +++ b/any.go @@ -8,8 +8,8 @@ import ( // EnvAny represents either arbitrary value or an environment reference. type EnvAny struct { - Value any `json:"value,omitempty" jsonschema:"anyof_required=value" mapstructure:"value" yaml:"value,omitempty"` - Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env" mapstructure:"env" yaml:"env,omitempty"` + Value any `json:"value,omitempty" jsonschema:"anyof_required=value,description=Default literal value if the env is empty" mapstructure:"value" yaml:"value,omitempty"` + Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env,description=Environment variable to be evaluated" mapstructure:"env" yaml:"env,omitempty"` } // NewEnvAny creates an EnvAny instance. diff --git a/environment.go b/environment.go index c1e9691..53fe64d 100644 --- a/environment.go +++ b/environment.go @@ -12,8 +12,8 @@ type GetEnvFunc func(string) (string, error) // EnvString represents either a literal string or an environment reference. type EnvString struct { - Value *string `json:"value,omitempty" jsonschema:"anyof_required=value" mapstructure:"value" yaml:"value,omitempty"` - Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env" mapstructure:"env" yaml:"env,omitempty"` + Value *string `json:"value,omitempty" jsonschema:"anyof_required=value,description=Default literal value if the env is empty" mapstructure:"value" yaml:"value,omitempty"` + Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env,description=Environment variable to be evaluated" mapstructure:"env" yaml:"env,omitempty"` } // NewEnvString creates an EnvString instance. @@ -119,8 +119,8 @@ func (ev EnvString) GetCustom(getFunc GetEnvFunc) (string, error) { // EnvInt represents either a literal integer or an environment reference. type EnvInt struct { - Value *int64 `json:"value,omitempty" jsonschema:"anyof_required=value" mapstructure:"value" yaml:"value,omitempty"` - Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env" mapstructure:"env" yaml:"env,omitempty"` + Value *int64 `json:"value,omitempty" jsonschema:"anyof_required=value,description=Default literal value if the env is empty" mapstructure:"value" yaml:"value,omitempty"` + Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env,description=Environment variable to be evaluated" mapstructure:"env" yaml:"env,omitempty"` } // NewEnvInt creates an EnvInt instance. @@ -223,8 +223,8 @@ func (ev EnvInt) GetCustom(getFunc GetEnvFunc) (int64, error) { // EnvBool represents either a literal boolean or an environment reference. type EnvBool struct { - Value *bool `json:"value,omitempty" jsonschema:"anyof_required=value" mapstructure:"value" yaml:"value,omitempty"` - Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env" mapstructure:"env" yaml:"env,omitempty"` + Value *bool `json:"value,omitempty" jsonschema:"anyof_required=value,description=Default literal value if the env is empty" mapstructure:"value" yaml:"value,omitempty"` + Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env,description=Environment variable to be evaluated" mapstructure:"env" yaml:"env,omitempty"` } // NewEnvBool creates an EnvBool instance. @@ -327,8 +327,8 @@ func (ev EnvBool) GetCustom(getFunc GetEnvFunc) (bool, error) { // EnvFloat represents either a literal floating point number or an environment reference. type EnvFloat struct { - Value *float64 `json:"value,omitempty" jsonschema:"anyof_required=value" mapstructure:"value" yaml:"value,omitempty"` - Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env" mapstructure:"env" yaml:"env,omitempty"` + Value *float64 `json:"value,omitempty" jsonschema:"anyof_required=value,description=Default literal value if the env is empty" mapstructure:"value" yaml:"value,omitempty"` + Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env,description=Environment variable to be evaluated" mapstructure:"env" yaml:"env,omitempty"` } // NewEnvFloat creates an EnvFloat instance. diff --git a/map.go b/map.go index a071575..e3ba800 100644 --- a/map.go +++ b/map.go @@ -7,8 +7,8 @@ import ( // EnvMapString represents either a literal string map or an environment reference. type EnvMapString struct { - Value map[string]string `json:"value,omitempty" jsonschema:"anyof_required=value" mapstructure:"value" yaml:"value,omitempty"` - Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env" mapstructure:"env" yaml:"env,omitempty"` + Value map[string]string `json:"value,omitempty" jsonschema:"anyof_required=value,description=Default literal value if the env is empty" mapstructure:"value" yaml:"value,omitempty"` + Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env,description=Environment variable to be evaluated" mapstructure:"env" yaml:"env,omitempty"` } // NewEnvMapString creates an EnvMapString instance. @@ -81,8 +81,8 @@ func (ev EnvMapString) GetCustom(getFunc GetEnvFunc) (map[string]string, error) // EnvMapInt represents either a literal int map or an environment reference. type EnvMapInt struct { - Value map[string]int64 `json:"value,omitempty" jsonschema:"anyof_required=value" mapstructure:"value" yaml:"value,omitempty"` - Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env" mapstructure:"env" yaml:"env,omitempty"` + Value map[string]int64 `json:"value,omitempty" jsonschema:"anyof_required=value,description=Default literal value if the env is empty" mapstructure:"value" yaml:"value,omitempty"` + Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env,description=Environment variable to be evaluated" mapstructure:"env" yaml:"env,omitempty"` } // NewEnvMapInt creates an EnvMapInt instance. @@ -155,8 +155,8 @@ func (ev EnvMapInt) GetCustom(getFunc GetEnvFunc) (map[string]int64, error) { // EnvMapFloat represents either a literal float map or an environment reference. type EnvMapFloat struct { - Value map[string]float64 `json:"value,omitempty" jsonschema:"anyof_required=value" mapstructure:"value" yaml:"value,omitempty"` - Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env" mapstructure:"env" yaml:"env,omitempty"` + Value map[string]float64 `json:"value,omitempty" jsonschema:"anyof_required=value,description=Default literal value if the env is empty" mapstructure:"value" yaml:"value,omitempty"` + Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env,description=Environment variable to be evaluated" mapstructure:"env" yaml:"env,omitempty"` } // NewEnvMapFloat creates an EnvMapFloat instance. @@ -229,8 +229,8 @@ func (ev EnvMapFloat) GetCustom(getFunc GetEnvFunc) (map[string]float64, error) // EnvMapBool represents either a literal bool map or an environment reference. type EnvMapBool struct { - Value map[string]bool `json:"value,omitempty" jsonschema:"anyof_required=value" mapstructure:"value" yaml:"value,omitempty"` - Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env" mapstructure:"env" yaml:"env,omitempty"` + Value map[string]bool `json:"value,omitempty" jsonschema:"anyof_required=value,description=Default literal value if the env is empty" mapstructure:"value" yaml:"value,omitempty"` + Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env,description=Environment variable to be evaluated" mapstructure:"env" yaml:"env,omitempty"` } // NewEnvMapBool creates an EnvMapBool instance. diff --git a/slice.go b/slice.go index 8524f93..c445b88 100644 --- a/slice.go +++ b/slice.go @@ -8,8 +8,8 @@ import ( // EnvStringSlice represents either a literal string slice or an environment reference. type EnvStringSlice struct { - Value []string `json:"value,omitempty" jsonschema:"anyof_required=value" mapstructure:"value" yaml:"value,omitempty"` - Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env" mapstructure:"env" yaml:"env,omitempty"` + Value []string `json:"value,omitempty" jsonschema:"anyof_required=value,description=Default literal value if the env is empty" mapstructure:"value" yaml:"value,omitempty"` + Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env,description=Environment variable to be evaluated" mapstructure:"env" yaml:"env,omitempty"` } // NewEnvStringSlice creates an EnvStringSlice instance. @@ -105,8 +105,8 @@ func (ev EnvStringSlice) GetCustom(getFunc GetEnvFunc) ([]string, error) { // EnvIntSlice represents either a literal integer slice or an environment reference. type EnvIntSlice struct { - Value []int64 `json:"value,omitempty" jsonschema:"anyof_required=value" mapstructure:"value" yaml:"value,omitempty"` - Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env" mapstructure:"env" yaml:"env,omitempty"` + Value []int64 `json:"value,omitempty" jsonschema:"anyof_required=value,description=Default literal value if the env is empty" mapstructure:"value" yaml:"value,omitempty"` + Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env,description=Environment variable to be evaluated" mapstructure:"env" yaml:"env,omitempty"` } // NewEnvIntSlice creates an EnvIntSlice instance. @@ -208,8 +208,8 @@ func (ev EnvIntSlice) GetCustom(getFunc GetEnvFunc) ([]int64, error) { // EnvFloatSlice represents either a literal floating-point number slice or an environment reference. type EnvFloatSlice struct { - Value []float64 `json:"value,omitempty" jsonschema:"anyof_required=value" mapstructure:"value" yaml:"value,omitempty"` - Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env" mapstructure:"env" yaml:"env,omitempty"` + Value []float64 `json:"value,omitempty" jsonschema:"anyof_required=value,description=Default literal value if the env is empty" mapstructure:"value" yaml:"value,omitempty"` + Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env,description=Environment variable to be evaluated" mapstructure:"env" yaml:"env,omitempty"` } // NewEnvFloatSlice creates an EnvFloatSlice instance. @@ -311,8 +311,8 @@ func (ev EnvFloatSlice) GetCustom(getFunc GetEnvFunc) ([]float64, error) { // EnvBoolSlice represents either a literal boolean slice or an environment reference. type EnvBoolSlice struct { - Value []bool `json:"value,omitempty" jsonschema:"anyof_required=value" mapstructure:"value" yaml:"value,omitempty"` - Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env" mapstructure:"env" yaml:"env,omitempty"` + Value []bool `json:"value,omitempty" jsonschema:"anyof_required=value,description=Default literal value if the env is empty" mapstructure:"value" yaml:"value,omitempty"` + Variable *string `json:"env,omitempty" jsonschema:"anyof_required=env,description=Environment variable to be evaluated" mapstructure:"env" yaml:"env,omitempty"` } // NewEnvBoolSlice creates an EnvBoolSlice instance.