Skip to content

Commit

Permalink
add comments to the helper functions
Browse files Browse the repository at this point in the history
Signed-off-by: Rich Baird <[email protected]>
  • Loading branch information
Rich Baird authored and Rich Baird committed Jul 25, 2022
1 parent f26bba5 commit ee52834
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/cnab/config-adapter/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
3 changes: 3 additions & 0 deletions pkg/manifest/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ee52834

Please sign in to comment.