diff --git a/furo/cmd/root.go b/furo/cmd/root.go index d1a00ca..27c1388 100644 --- a/furo/cmd/root.go +++ b/furo/cmd/root.go @@ -50,7 +50,7 @@ Modify your default flow in the .furo config file to your needs. You can set any Run: func(cmd *cobra.Command, args []string) { runner.Run(cmd, args) }, - Version: "1.36.0", + Version: "1.36.1", } // Execute adds all child commands to the root command and sets flags appropriately. diff --git a/furo/flow_test.go b/furo/flow_test.go index aad56f4..2c9d5cf 100644 --- a/furo/flow_test.go +++ b/furo/flow_test.go @@ -18,7 +18,7 @@ func TestRunCommand(t *testing.T) { rco.Execute() require.Equal(t, true, test.FileExist(path.Join(dir, ".furo"))) - require.Equal(t, "1d5bc788b2dddab1c7cc1e3e62e6682e", test.MustMd5Sum(path.Join(dir, ".furo"))) + require.Equal(t, "f5dfacb251ad443ddd69f569b36665b0", test.MustMd5Sum(path.Join(dir, ".furo"))) os.Args = []string{"cmd", "install"} rco.Execute() diff --git a/furo/init_test.go b/furo/init_test.go index 8ab447f..50905ca 100644 --- a/furo/init_test.go +++ b/furo/init_test.go @@ -18,6 +18,6 @@ func TestInitCommand(t *testing.T) { rco.Execute() require.Equal(t, true, test.FileExist(path.Join(dir, ".furo"))) - require.Equal(t, "1d5bc788b2dddab1c7cc1e3e62e6682e", test.MustMd5Sum(path.Join(dir, ".furo"))) + require.Equal(t, "f5dfacb251ad443ddd69f569b36665b0", test.MustMd5Sum(path.Join(dir, ".furo"))) } diff --git a/furo/installer_test.go b/furo/installer_test.go index 1283b9f..3693e28 100644 --- a/furo/installer_test.go +++ b/furo/installer_test.go @@ -18,7 +18,7 @@ func TestInstallCommand(t *testing.T) { rco.Execute() require.Equal(t, true, test.FileExist(path.Join(dir, ".furo"))) - require.Equal(t, "1d5bc788b2dddab1c7cc1e3e62e6682e", test.MustMd5Sum(path.Join(dir, ".furo"))) + require.Equal(t, "f5dfacb251ad443ddd69f569b36665b0", test.MustMd5Sum(path.Join(dir, ".furo"))) os.Args = []string{"cmd", "install"} rco.Execute() diff --git a/furo/internal/cmd/genEsModule/genEsModule.go b/furo/internal/cmd/genEsModule/genEsModule.go index 8404aad..8d982a2 100644 --- a/furo/internal/cmd/genEsModule/genEsModule.go +++ b/furo/internal/cmd/genEsModule/genEsModule.go @@ -51,6 +51,7 @@ func Run(cmd *cobra.Command, args []string) { field.Meta.Options.Flags = append(field.Meta.Options.Flags, "enum") // loop all enum values to build the options + isenum := false for enum := allTypes[field.Type].Values.Oldest(); enum != nil; enum = enum.Next() { option := map[string]interface{}{} option["display_name"] = strings.ToLower("enum." + field.Type + "." + enum.Key.(string) + ".label") @@ -58,10 +59,16 @@ func Run(cmd *cobra.Command, args []string) { option["@type"] = "type.googleapis.com/furo.Optionitem" option["selected"] = false field.Meta.Options.List = append(field.Meta.Options.List, &option) + isenum = true } - // fmt.Println(k, allTypes[field.Type].Values) + // set the type on the field to enum + if isenum { + field.Meta.Typespecific = &map[string]interface{}{"enum": field.Type} + field.Type = "enum" + } } + } } diff --git a/furo/spec2muSpec_test.go b/furo/spec2muSpec_test.go index 02beccb..9664e24 100644 --- a/furo/spec2muSpec_test.go +++ b/furo/spec2muSpec_test.go @@ -47,9 +47,9 @@ func TestSpec2muSpecCommand(t *testing.T) { require.Equal(t, true, test.FileExist(path.Join(dir, "muspecs"))) // initial were 2 files in muspec, spec2Muspec creates one file per spec, so we have 4 files now - require.Equal(t, "f9456cc68a2b69691d5cbca5a7fcb5aa", test.MustMd5Sum(path.Join(dir, "muspecs", "sample", "Sample.types.yaml"))) - require.Equal(t, "102b3562851cc4bac750b6d409344f6e", test.MustMd5Sum(path.Join(dir, "muspecs", "sample", "SampleCollection.types.yaml"))) - require.Equal(t, "cecdceb48471dc1b2ebc958ce30e97bb", test.MustMd5Sum(path.Join(dir, "muspecs", "sample", "SampleEntity.types.yaml"))) + require.Equal(t, "6e90ff428e600c214b2d54b649f3e29f", test.MustMd5Sum(path.Join(dir, "muspecs", "sample", "Sample.types.yaml"))) + require.Equal(t, "cbbcb8c070aebbaf7d7db052c77065cf", test.MustMd5Sum(path.Join(dir, "muspecs", "sample", "SampleCollection.types.yaml"))) + require.Equal(t, "744327bcc82804c191f9c85c0d2f37be", test.MustMd5Sum(path.Join(dir, "muspecs", "sample", "SampleEntity.types.yaml"))) require.Equal(t, "32ab721229ebbea7fe4fc42bc4a34a1a", test.MustMd5Sum(path.Join(dir, "muspecs", "sample", "Samples.services.yaml"))) }