Skip to content

Commit

Permalink
Fix paramValueType in conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeJu committed Sep 15, 2022
1 parent 1a1f2e3 commit a95bc73
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions pkg/apis/pipeline/v1beta1/param_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import (

func (p ParamSpec) convertTo(ctx context.Context, sink *v1.ParamSpec) {
sink.Name = p.Name
sink.Type = v1.ParamType(p.Type)
if p.Type != "" {
sink.Type = v1.ParamType(p.Type)
} else {
sink.Type = v1.ParamType(ParamTypeString)
}
sink.Description = p.Description
var properties map[string]v1.PropertySpec
if p.Properties != nil {
Expand All @@ -28,7 +32,11 @@ func (p ParamSpec) convertTo(ctx context.Context, sink *v1.ParamSpec) {

func (p *ParamSpec) convertFrom(ctx context.Context, source v1.ParamSpec) {
p.Name = source.Name
p.Type = ParamType(source.Type)
if p.Type != "" {
p.Type = ParamType(source.Type)
} else {
p.Type = ParamTypeString
}
p.Description = source.Description
var properties map[string]PropertySpec
if source.Properties != nil {
Expand Down Expand Up @@ -61,13 +69,22 @@ func (p *Param) convertFrom(ctx context.Context, source v1.Param) {
}

func (v ParamValue) convertTo(ctx context.Context, sink *v1.ParamValue) {
sink.Type = v1.ParamType(v.Type)
if v.Type != "" {
sink.Type = v1.ParamType(v.Type)
} else {
sink.Type = v1.ParamType(ParamTypeString)
}
sink.StringVal = v.StringVal
sink.ArrayVal = v.ArrayVal
sink.ObjectVal = v.ObjectVal
}

func (v *ParamValue) convertFrom(ctx context.Context, source v1.ParamValue) {
if v.Type != "" {
v.Type = ParamType(source.Type)
} else {
v.Type = ParamTypeString
}
v.Type = ParamType(source.Type)
v.StringVal = source.StringVal
v.ArrayVal = source.ArrayVal
Expand Down

0 comments on commit a95bc73

Please sign in to comment.