diff --git a/assets/default_config.yaml b/assets/default_config.yaml index 5bdcfef..0b5221a 100644 --- a/assets/default_config.yaml +++ b/assets/default_config.yaml @@ -5,7 +5,7 @@ runtimeModule: github.com/bdragon300/go-asyncapi/run directories: templates: target: ./asyncapi - implementations: impl + implementations: ./asyncapi/impl selections: - objectKinds: ["schema"] diff --git a/cmd/go-asyncapi/generate.go b/cmd/go-asyncapi/generate.go index 03707b7..7cec880 100644 --- a/cmd/go-asyncapi/generate.go +++ b/cmd/go-asyncapi/generate.go @@ -118,8 +118,7 @@ func generate(cmd *GenerateCmd) error { if err != nil { return fmt.Errorf("%w: %w", ErrWrongCliArgs, err) } - implDir := path.Join(mergedConfig.Directories.Target, mergedConfig.Directories.Implementations) - logger.Debugf("Target implementations directory is %s", implDir) + logger.Debugf("Target implementations directory is %s", mergedConfig.Directories.Implementations) tmpl.ParseTemplates(mergedConfig.Directories.Templates) // Compilation @@ -160,7 +159,7 @@ func generate(cmd *GenerateCmd) error { // Rendering the selected implementations if !mergedConfig.NoImplementations { selectedImpls := getImplementationsOpts(mergedConfig.Implementations) - if err = generationWriteImplementations(selectedImpls, mainModule.Protocols(), implDir); err != nil { + if err = generationWriteImplementations(selectedImpls, mainModule.Protocols(), mergedConfig.Directories.Implementations); err != nil { return err } } @@ -170,11 +169,10 @@ func generate(cmd *GenerateCmd) error { } func generateImplementation(cmd *generateImplementationArgs, conf toolConfig) error { - implDir := path.Join(conf.Directories.Target, conf.Directories.Implementations) // TODO: remove this line - log.GetLogger("").Debugf("Target implementations directory is %s", implDir) + log.GetLogger("").Debugf("Target implementations directory is %s", conf.Directories.Implementations) proto := cmd.Protocol name := cmd.Name - if err := generationWriteImplementations(map[string]string{proto: name}, []string{proto}, implDir); err != nil { + if err := generationWriteImplementations(map[string]string{proto: name}, []string{proto}, conf.Directories.Implementations); err != nil { return err }