Skip to content

Commit 5fe94bc

Browse files
committed
Fix moduleconfig structure to match the schema from the google doc
1 parent 37178ba commit 5fe94bc

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

internal/config/moduleconfig/module_config.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,28 @@ import (
88
)
99

1010
type ModuleConfig struct {
11-
Name string
12-
Description string
13-
Author string
14-
Icon string
15-
Thumbnail string
16-
Template TemplateConfig
17-
Credentials []string `yaml:"requiredCredentials"`
18-
Prompts []Prompt `yaml:"parameters"`
11+
Name string
12+
Description string
13+
Author string
14+
TemplateConfig `yaml:"template"`
15+
RequiredCredentials []string
16+
Parameters []Parameter
1917
}
2018

21-
type Prompt struct {
22-
Field string `yaml:"field,omitempty"`
23-
Label string
19+
type Parameter struct {
20+
Field string
21+
Label string `yaml:"value,omitempty"`
2422
Options []string `yaml:"options,omitempty"`
2523
Execute string `yaml:"execute,omitempty"`
24+
Value string `yaml:"value,omitempty"`
25+
Default string `yaml:"default,omitempty"`
2626
}
2727

2828
type TemplateConfig struct {
2929
StrictMode bool
3030
Delimiters []string
31-
Output string
31+
InputDir string
32+
OutputDir string
3233
}
3334

3435
func LoadModuleConfig(filePath string) (ModuleConfig, error) {

internal/generate/generate_modules.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ type TemplateParams struct {
5858
}
5959

6060
func Generate(mod *module.TemplateModule, generatorCfg *config.GeneratorConfig) error {
61-
moduleDir := module.GetSourceDir(mod.Source)
62-
delimiters := mod.Config.Template.Delimiters
61+
moduleDir := path.Join(module.GetSourceDir(mod.Source), mod.Config.TemplateConfig.InputDir)
62+
delimiters := mod.Config.TemplateConfig.Delimiters
6363
overwrite := mod.Overwrite
6464
outputDir := mod.Output
6565
if outputDir == "" {
66-
outputDir = mod.Config.Template.Output
66+
outputDir = mod.Config.TemplateConfig.OutputDir
6767
}
6868

6969
templateData := TemplateParams{}

internal/module/module.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func PromptParams(moduleConfig moduleconfig.ModuleConfig, parameters map[string]
6464

6565
// PromptParams renders series of prompt UI based on the config
6666
func (m *TemplateModule) PromptParams(projectContext map[string]string) error {
67-
for _, promptConfig := range m.Config.Prompts {
67+
for _, promptConfig := range m.Config.Parameters {
6868

6969
label := promptConfig.Label
7070
if promptConfig.Label == "" {

0 commit comments

Comments
 (0)