@@ -8,12 +8,14 @@ import (
88 "path/filepath"
99 "runtime/debug"
1010
11+ _ "github.com/gotomicro/eapi/generators/axios"
1112 _ "github.com/gotomicro/eapi/generators/ts"
1213 _ "github.com/gotomicro/eapi/generators/umi"
1314 "github.com/gotomicro/eapi/spec"
1415 "github.com/knadh/koanf"
1516 "github.com/knadh/koanf/parsers/yaml"
1617 "github.com/knadh/koanf/providers/file"
18+ "github.com/mitchellh/mapstructure"
1719 "github.com/urfave/cli/v2"
1820)
1921
@@ -230,8 +232,24 @@ func (e *Entrypoint) run(c *cli.Context) error {
230232 }
231233
232234 // execute generators
233- for _ , item := range e .cfg .Generators {
234- err = newGeneratorExecutor (item , doc ).execute ()
235+ for idx , item := range e .cfg .Generators {
236+ err = newGeneratorExecutor (
237+ item ,
238+ doc ,
239+ func (value interface {}) error {
240+ raw := e .k .Raw ()["generators" ].([]interface {})[idx ]
241+ d , _ := mapstructure .NewDecoder (& mapstructure.DecoderConfig {
242+ DecodeHook : mapstructure .ComposeDecodeHookFunc (
243+ mapstructure .StringToTimeDurationHookFunc (),
244+ mapstructure .StringToSliceHookFunc ("," ),
245+ mapstructure .TextUnmarshallerHookFunc ()),
246+ Metadata : nil ,
247+ Result : value ,
248+ WeaklyTypedInput : true ,
249+ })
250+ return d .Decode (raw )
251+ },
252+ ).execute ()
235253 if err != nil {
236254 return err
237255 }
0 commit comments