Skip to content

Commit

Permalink
add error handling when receiving datetime type
Browse files Browse the repository at this point in the history
  • Loading branch information
takanakahiko committed Sep 19, 2023
1 parent 1224f42 commit 1ff713c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"path/filepath"
"strings"
"time"

"github.com/pkg/errors"
"github.com/spf13/afero"
Expand Down Expand Up @@ -409,6 +410,9 @@ func convertToParams(p interface{}) (map[string]interface{}, error) {
}
params[key] = append(params[key].([]map[string]interface{}), p)
}
case time.Time:
// yaml.v3 からは日付型がサポートされるが、json の値を比較する atgen の性質上、日時は文字列のまま扱う方が都合が良い
return params, errors.New("atgen does not support datetime type yaml input. Please enclose the datetime in double quotes and enter it as a string.")
default:
return params, errors.New("invalid type")
}
Expand Down

0 comments on commit 1ff713c

Please sign in to comment.