From 9689a79f22bc54ae073991620cb598d65986cac5 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 4 Sep 2024 17:42:02 +0200 Subject: [PATCH] address comments --- bundle/config/root_test.go | 2 +- bundle/config/target.go | 7 +------ bundle/config/variable/variable.go | 5 +++++ bundle/internal/schema/main.go | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bundle/config/root_test.go b/bundle/config/root_test.go index a3934267be..d2c7a9b1fa 100644 --- a/bundle/config/root_test.go +++ b/bundle/config/root_test.go @@ -139,7 +139,7 @@ func TestRootMergeTargetOverridesWithVariables(t *testing.T) { }, Targets: map[string]*Target{ "development": { - Variables: map[string]*TargetVariable{ + Variables: map[string]*variable.TargetVariable{ "foo": { Default: "bar", Description: "wrong", diff --git a/bundle/config/target.go b/bundle/config/target.go index a3cd106b57..fc6ba7b5bb 100644 --- a/bundle/config/target.go +++ b/bundle/config/target.go @@ -8,11 +8,6 @@ import ( type Mode string -// We alias it here to override the JSON schema associated with a variable value -// in a target override. This is because we allow for directly specifying the value -// in addition to the variable.Variable struct format in a target override. -type TargetVariable variable.Variable - // Target defines overrides for a single target. // This structure is recursively merged into the root configuration. type Target struct { @@ -62,7 +57,7 @@ type Target struct { // variables: // foo: // lookup: "resource_name" - Variables map[string]*TargetVariable `json:"variables,omitempty"` + Variables map[string]*variable.TargetVariable `json:"variables,omitempty"` Git Git `json:"git,omitempty"` diff --git a/bundle/config/variable/variable.go b/bundle/config/variable/variable.go index ba94f9c8a5..2362ad10d9 100644 --- a/bundle/config/variable/variable.go +++ b/bundle/config/variable/variable.go @@ -16,6 +16,11 @@ const ( VariableTypeComplex VariableType = "complex" ) +// We alias it here to override the JSON schema associated with a variable value +// in a target override. This is because we allow for directly specifying the value +// in addition to the variable.Variable struct format in a target override. +type TargetVariable Variable + // An input variable for the bundle config type Variable struct { // A type of the variable. This is used to validate the value of the variable diff --git a/bundle/internal/schema/main.go b/bundle/internal/schema/main.go index 51eb1e2668..2e4e67355c 100644 --- a/bundle/internal/schema/main.go +++ b/bundle/internal/schema/main.go @@ -23,7 +23,7 @@ func addInterpolationPatterns(typ reflect.Type, s jsonschema.Schema) jsonschema. // The variables block in a target override allows for directly specifying // the value if it is a primitive type. - if typ == reflect.TypeOf(config.TargetVariable{}) { + if typ == reflect.TypeOf(variable.TargetVariable{}) { return jsonschema.Schema{ AnyOf: []jsonschema.Schema{s, {Type: jsonschema.StringType},