Skip to content

Commit

Permalink
fix(api): workflow template check params typos (#6541)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsamin committed Apr 25, 2023
1 parent 2d29833 commit 2f668b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sdk/workflow_template.go
Expand Up @@ -148,18 +148,18 @@ func (w *WorkflowTemplate) CheckParams(r WorkflowTemplateRequest) error {
switch p.Type {
case ParameterTypeBoolean:
if v != "" && !(v == "true" || v == "false") {
return NewErrorFrom(ErrInvalidData, "Given value it's not a boolean for %s", p.Key)
return NewErrorFrom(ErrInvalidData, "%q value should be a boolean", p.Key)
}
case ParameterTypeRepository:
sp := strings.Split(v, "/")
if len(sp) != 3 {
return NewErrorFrom(ErrInvalidData, "Given value don't match vcs/repository pattern for %s", p.Key)
return NewErrorFrom(ErrInvalidData, "%q value should match vcs/repository pattern", p.Key)
}
case ParameterTypeJSON:
if v != "" {
var res interface{}
if err := JSONUnmarshal([]byte(v), &res); err != nil {
return NewErrorFrom(ErrInvalidData, "Given value it's not json for %s", p.Key)
return NewErrorFrom(ErrInvalidData, "%q value should be json", p.Key)
}
}
}
Expand Down

0 comments on commit 2f668b7

Please sign in to comment.