From ee5283470f147ea6d286a35502ecc1a13ddb53b1 Mon Sep 17 00:00:00 2001 From: Rich Baird Date: Fri, 15 Jul 2022 16:17:52 -0500 Subject: [PATCH] add comments to the helper functions Signed-off-by: Rich Baird --- pkg/cnab/config-adapter/helpers.go | 11 ++++++++--- pkg/manifest/helpers.go | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/cnab/config-adapter/helpers.go b/pkg/cnab/config-adapter/helpers.go index 404c87a2b..cf48acc2a 100644 --- a/pkg/cnab/config-adapter/helpers.go +++ b/pkg/cnab/config-adapter/helpers.go @@ -17,12 +17,17 @@ func ConvertToTestBundle(ctx context.Context, cfg *config.Config, manifest *mani return converter.ToBundle(ctx) } - -func MakeCNABCompatible(schema *definition.Schema) { +// MakeCNABCompatible receives a schema with possible porter specific parameters +// and converts those parameters to CNAB compatible versions. +// Returns true if values were replaced and false otherwise. +func MakeCNABCompatible(schema *definition.Schema) bool { if v, ok := schema.Type.(string); ok { if t, ok := config.PorterParamMap[v]; ok { - schema.Type = t; + schema.Type = t schema.ContentEncoding = "base64" + return ok } } + + return false } \ No newline at end of file diff --git a/pkg/manifest/helpers.go b/pkg/manifest/helpers.go index 7742e8b42..49c1944ed 100644 --- a/pkg/manifest/helpers.go +++ b/pkg/manifest/helpers.go @@ -2,6 +2,9 @@ package manifest import "get.porter.sh/porter/pkg/config" +// MakeCNABCompatible receives a schema with possible porter specific parameters +// and converts those parameters to CNAB compatible versions. +// Returns true if values were replaced and false otherwise. func MakeCNABCompatible(def *ParameterDefinition) bool { if v, ok := def.Type.(string); ok { if t, ok := config.PorterParamMap[v]; ok {