You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ossie.apache.org by jb...@apache.org on 2026/07/13 16:16:11 UTC

(ossie) 07/10: refactor(plugin): rename osi → ossie in ConvertConfig, yaml fields, and invoke args

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch pr-6
in repository https://gitbox.apache.org/repos/asf/ossie.git

commit fb5069d6eb336570ac9f190d8b3c66f303c99978
Author: Quigley Malcolm <qu...@dbtlabs.com>
AuthorDate: Tue Jun 23 16:20:35 2026 -0500

    refactor(plugin): rename osi → ossie in ConvertConfig, yaml fields, and invoke args
    
    ConvertConfig.ToOSI/FromOSI and the plugin.yaml fields to_osi/from_osi
    were left using the old brand name. This sweeps them to ossie
    consistently with the rest of the CLI rename.
    
    to_ossie/from_ossie are now the canonical yaml keys. to_osi/from_osi
    are kept as deprecated fallbacks in rawPlugin, using the same
    ossie-wins merge pattern already established for
    ossie_plugin_spec/osi_plugin_spec. The invoke-arg convention
    (to-ossie, from-ossie) is updated in all canonical test fixtures; the
    two backward-compat tests (TestDiscover_ossieKeyPreferred,
    TestDiscover_osiKeyFallback) intentionally retain to_osi/from_osi
    since they exercise the deprecated-key path.
---
 cli/internal/plugin/discover_test.go | 36 ++++++++++----------
 cli/internal/plugin/plugin.go        | 66 +++++++++++++++++++++++++++---------
 2 files changed, 68 insertions(+), 34 deletions(-)

diff --git a/cli/internal/plugin/discover_test.go b/cli/internal/plugin/discover_test.go
index 2c82475..71ee85e 100644
--- a/cli/internal/plugin/discover_test.go
+++ b/cli/internal/plugin/discover_test.go
@@ -18,11 +18,11 @@ platform:
   name: dbt
   vendor: dbt Labs
 convert:
-  to_osi:
-    invoke: ["ossie-plugin-dbt", "to-osi"]
+  to_ossie:
+    invoke: ["ossie-plugin-dbt", "to-ossie"]
     accepts: [".yaml", ".json"]
-  from_osi:
-    invoke: ["ossie-plugin-dbt", "from-osi"]
+  from_ossie:
+    invoke: ["ossie-plugin-dbt", "from-ossie"]
 `
 
 // writePlugin creates a plugin directory under root with the given plugin.yaml content.
@@ -94,17 +94,17 @@ func TestDiscover_validPlugin(t *testing.T) {
 	if p.OSSIESpecVersion != ">=0.2.0" {
 		t.Errorf("OSSIESpecVersion: got %q, want %q", p.OSSIESpecVersion, ">=0.2.0")
 	}
-	wantInvoke := []string{"ossie-plugin-dbt", "to-osi"}
-	if !slices.Equal(p.Convert.ToOSI.Invoke, wantInvoke) {
-		t.Errorf("ToOSI.Invoke: got %v, want %v", p.Convert.ToOSI.Invoke, wantInvoke)
+	wantInvoke := []string{"ossie-plugin-dbt", "to-ossie"}
+	if !slices.Equal(p.Convert.ToOssie.Invoke, wantInvoke) {
+		t.Errorf("ToOssie.Invoke: got %v, want %v", p.Convert.ToOssie.Invoke, wantInvoke)
 	}
 	wantAccepts := []string{".yaml", ".json"}
-	if !slices.Equal(p.Convert.ToOSI.Accepts, wantAccepts) {
-		t.Errorf("ToOSI.Accepts: got %v, want %v", p.Convert.ToOSI.Accepts, wantAccepts)
+	if !slices.Equal(p.Convert.ToOssie.Accepts, wantAccepts) {
+		t.Errorf("ToOssie.Accepts: got %v, want %v", p.Convert.ToOssie.Accepts, wantAccepts)
 	}
-	wantFromInvoke := []string{"ossie-plugin-dbt", "from-osi"}
-	if !slices.Equal(p.Convert.FromOSI.Invoke, wantFromInvoke) {
-		t.Errorf("FromOSI.Invoke: got %v, want %v", p.Convert.FromOSI.Invoke, wantFromInvoke)
+	wantFromInvoke := []string{"ossie-plugin-dbt", "from-ossie"}
+	if !slices.Equal(p.Convert.FromOssie.Invoke, wantFromInvoke) {
+		t.Errorf("FromOssie.Invoke: got %v, want %v", p.Convert.FromOssie.Invoke, wantFromInvoke)
 	}
 	if stderr.Len() != 0 {
 		t.Errorf("unexpected warning: %q", stderr.String())
@@ -136,10 +136,10 @@ ossie_spec_version: ">=0.2.0"
 platform:
   vendor: dbt Labs
 convert:
-  to_osi:
+  to_ossie:
     invoke: ["bin/convert"]
     accepts: [".yaml"]
-  from_osi:
+  from_ossie:
     invoke: ["bin/convert"]
 `)
 	var stderr strings.Builder
@@ -295,11 +295,11 @@ platform:
   name: dbt
 setup: bin/setup
 convert:
-  to_osi:
-    invoke: ["bin/convert", "to-osi"]
+  to_ossie:
+    invoke: ["bin/convert", "to-ossie"]
     accepts: [".yaml"]
-  from_osi:
-    invoke: ["bin/convert", "from-osi"]
+  from_ossie:
+    invoke: ["bin/convert", "from-ossie"]
 `)
 	var stderr strings.Builder
 
diff --git a/cli/internal/plugin/plugin.go b/cli/internal/plugin/plugin.go
index 00fa5a1..f370bf7 100644
--- a/cli/internal/plugin/plugin.go
+++ b/cli/internal/plugin/plugin.go
@@ -21,14 +21,14 @@ type Platform struct {
 
 // ConvertConfig holds both conversion directions.
 type ConvertConfig struct {
-	ToOSI   Direction
-	FromOSI Direction
+	ToOssie   Direction
+	FromOssie Direction
 }
 
 // Direction describes one conversion direction.
 type Direction struct {
 	Invoke  []string // command + args; first element is the executable
-	Accepts []string // file extensions e.g. [".yaml"]; populated on ToOSI only
+	Accepts []string // file extensions e.g. [".yaml"]; populated on ToOssie only
 }
 
 // rawPlugin mirrors the on-disk plugin.yaml layout for YAML unmarshaling.
@@ -51,11 +51,18 @@ type rawPlugin struct {
 	Setup string `yaml:"setup"`
 
 	Convert struct {
-		ToOSI struct {
+		ToOssie struct {
+			Invoke  []string `yaml:"invoke"`
+			Accepts []string `yaml:"accepts"`
+		} `yaml:"to_ossie"`
+		ToOSI struct { // deprecated
 			Invoke  []string `yaml:"invoke"`
 			Accepts []string `yaml:"accepts"`
 		} `yaml:"to_osi"`
-		FromOSI struct {
+		FromOssie struct {
+			Invoke []string `yaml:"invoke"`
+		} `yaml:"from_ossie"`
+		FromOSI struct { // deprecated
 			Invoke []string `yaml:"invoke"`
 		} `yaml:"from_osi"`
 	} `yaml:"convert"`
@@ -73,6 +80,19 @@ func (r *rawPlugin) validate() error {
 		specVersion = r.OSISpecVersion
 	}
 
+	toInvoke := r.Convert.ToOssie.Invoke
+	if len(toInvoke) == 0 {
+		toInvoke = r.Convert.ToOSI.Invoke
+	}
+	toAccepts := r.Convert.ToOssie.Accepts
+	if len(toAccepts) == 0 {
+		toAccepts = r.Convert.ToOSI.Accepts
+	}
+	fromInvoke := r.Convert.FromOssie.Invoke
+	if len(fromInvoke) == 0 {
+		fromInvoke = r.Convert.FromOSI.Invoke
+	}
+
 	switch {
 	case pluginSpec == "":
 		return errors.New("missing required field: ossie_plugin_spec (or osi_plugin_spec)")
@@ -80,12 +100,12 @@ func (r *rawPlugin) validate() error {
 		return errors.New("missing required field: ossie_spec_version (or osi_spec_version)")
 	case r.Platform.Name == "":
 		return errors.New("missing required field: platform.name")
-	case len(r.Convert.ToOSI.Invoke) == 0:
-		return errors.New("missing required field: convert.to_osi.invoke")
-	case len(r.Convert.ToOSI.Accepts) == 0:
-		return errors.New("missing required field: convert.to_osi.accepts")
-	case len(r.Convert.FromOSI.Invoke) == 0:
-		return errors.New("missing required field: convert.from_osi.invoke")
+	case len(toInvoke) == 0:
+		return errors.New("missing required field: convert.to_ossie.invoke (or convert.to_osi.invoke)")
+	case len(toAccepts) == 0:
+		return errors.New("missing required field: convert.to_ossie.accepts (or convert.to_osi.accepts)")
+	case len(fromInvoke) == 0:
+		return errors.New("missing required field: convert.from_ossie.invoke (or convert.from_osi.invoke)")
 	}
 	return nil
 }
@@ -101,6 +121,20 @@ func (r *rawPlugin) toPlugin(path string) *Plugin {
 	if specVersion == "" {
 		specVersion = r.OSISpecVersion
 	}
+
+	toInvoke := r.Convert.ToOssie.Invoke
+	if len(toInvoke) == 0 {
+		toInvoke = r.Convert.ToOSI.Invoke
+	}
+	toAccepts := r.Convert.ToOssie.Accepts
+	if len(toAccepts) == 0 {
+		toAccepts = r.Convert.ToOSI.Accepts
+	}
+	fromInvoke := r.Convert.FromOssie.Invoke
+	if len(fromInvoke) == 0 {
+		fromInvoke = r.Convert.FromOSI.Invoke
+	}
+
 	return &Plugin{
 		Path:             path,
 		OSSIEPluginSpec:  pluginSpec,
@@ -111,12 +145,12 @@ func (r *rawPlugin) toPlugin(path string) *Plugin {
 		},
 		Setup: r.Setup,
 		Convert: ConvertConfig{
-			ToOSI: Direction{
-				Invoke:  r.Convert.ToOSI.Invoke,
-				Accepts: r.Convert.ToOSI.Accepts,
+			ToOssie: Direction{
+				Invoke:  toInvoke,
+				Accepts: toAccepts,
 			},
-			FromOSI: Direction{
-				Invoke: r.Convert.FromOSI.Invoke,
+			FromOssie: Direction{
+				Invoke: fromInvoke,
 			},
 		},
 	}