From 2e11867b5b31dda8b21615670a0c60e8e608e24c Mon Sep 17 00:00:00 2001 From: Matthias De Vriendt Date: Mon, 8 Dec 2025 12:06:11 +0100 Subject: [PATCH] remove support for runtime versions --- builders/consumer.go | 2 +- builders/consumer_core.go | 2 +- builders/consumer_kv.go | 2 +- builders/consumer_stream.go | 2 +- builders/nats.go | 2 +- builders/producer.go | 2 +- builders/producer_core.go | 2 +- builders/producer_kv.go | 2 +- builders/producer_stream.go | 2 +- builders/sink.go | 2 +- builders/source.go | 2 +- builders/steps.go | 2 +- builders/transformer.go | 2 +- builders/transformer_combine.go | 2 +- builders/transformer_composite.go | 2 +- builders/transformer_explode.go | 2 +- builders/transformer_mapping.go | 2 +- builders/transformer_service.go | 2 +- builders/transformer_test.go | 2 +- cli/connector_command.go | 33 ++++--- cli/connector_command_helpers.go | 4 +- cli/connector_command_test.go | 9 +- cli/library_command.go | 72 +++----------- cli/library_command_helpers.go | 20 ++-- cli/library_command_test.go | 2 +- cli/options.go | 2 +- cli/render.go | 12 +-- cli/render_test.go | 2 +- cli/standalone.go | 8 +- cli/standalone_helpers.go | 4 +- cli/templates.go | 4 +- cli/test_helpers_test.go | 8 +- client/client.go | 8 +- client/connector.go | 8 +- client/library.go | 19 ++-- client/library_test.go | 2 +- cmd/connect/main.go | 2 +- convert/from_spec.go | 4 +- convert/to_spec.go | 4 +- docker/runner.go | 2 +- go.mod | 4 +- model/connector_create.go | 9 +- model/connector_delete.go | 6 +- model/connector_get.go | 6 +- model/connector_instances.go | 6 +- model/connector_models.go | 14 +-- model/connector_patch.go | 6 +- model/connector_start.go | 6 +- model/connector_status.go | 6 +- model/connector_stop.go | 6 +- model/crawler.go | 22 +++-- model/library.go | 124 ++++-------------------- model/schemas/library.schema.json | 87 ++++------------- runtime/runtime.go | 2 +- runtime/runtime_test.go | 4 +- spec/builders/connector.go | 2 +- spec/builders/consumer.go | 2 +- spec/builders/consumer_core.go | 2 +- spec/builders/consumer_kv.go | 2 +- spec/builders/consumer_stream.go | 2 +- spec/builders/nats.go | 2 +- spec/builders/producer.go | 2 +- spec/builders/producer_core.go | 2 +- spec/builders/producer_kv.go | 2 +- spec/builders/producer_stream.go | 2 +- spec/builders/sink.go | 2 +- spec/builders/source.go | 2 +- spec/builders/steps.go | 2 +- spec/builders/transformer.go | 2 +- spec/builders/transformer_combine.go | 2 +- spec/builders/transformer_composite.go | 2 +- spec/builders/transformer_explode.go | 2 +- spec/builders/transformer_mapping.go | 2 +- spec/builders/transformer_service.go | 2 +- spec/common.go | 6 +- spec/connector.go | 11 +-- spec/schemas/connector-spec.schema.json | 4 - standalone/converter.go | 2 +- validation/validator.go | 2 +- 79 files changed, 224 insertions(+), 414 deletions(-) diff --git a/builders/consumer.go b/builders/consumer.go index 12380d3..5eee886 100644 --- a/builders/consumer.go +++ b/builders/consumer.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type ConsumerStepBuilder struct { res *model.ConsumerStep diff --git a/builders/consumer_core.go b/builders/consumer_core.go index 71cec14..bd336bc 100644 --- a/builders/consumer_core.go +++ b/builders/consumer_core.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type ConsumerStepCoreBuilder struct { res *model.ConsumerStepCore diff --git a/builders/consumer_kv.go b/builders/consumer_kv.go index e6b8f20..8aecda2 100644 --- a/builders/consumer_kv.go +++ b/builders/consumer_kv.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type ConsumerStepKvBuilder struct { res *model.ConsumerStepKv diff --git a/builders/consumer_stream.go b/builders/consumer_stream.go index 5508af4..9693ebc 100644 --- a/builders/consumer_stream.go +++ b/builders/consumer_stream.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type ConsumerStepStreamBuilder struct { res *model.ConsumerStepStream diff --git a/builders/nats.go b/builders/nats.go index 8add1ec..48e3ebf 100644 --- a/builders/nats.go +++ b/builders/nats.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" const DefaultNatsUrl = "nats://localhost:4222" diff --git a/builders/producer.go b/builders/producer.go index 6d7f551..3aa12ca 100644 --- a/builders/producer.go +++ b/builders/producer.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type ProducerStepBuilder struct { res *model.ProducerStep diff --git a/builders/producer_core.go b/builders/producer_core.go index 01de8db..ee93af7 100644 --- a/builders/producer_core.go +++ b/builders/producer_core.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type ProducerStepCoreBuilder struct { res *model.ProducerStepCore diff --git a/builders/producer_kv.go b/builders/producer_kv.go index dd10eb8..3f50f9d 100644 --- a/builders/producer_kv.go +++ b/builders/producer_kv.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type ProducerStepKvBuilder struct { res *model.ProducerStepKv diff --git a/builders/producer_stream.go b/builders/producer_stream.go index d9e4dd3..89a55a9 100644 --- a/builders/producer_stream.go +++ b/builders/producer_stream.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type ProducerStepStreamBuilder struct { res *model.ProducerStepStream diff --git a/builders/sink.go b/builders/sink.go index c86a9fa..341b420 100644 --- a/builders/sink.go +++ b/builders/sink.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type SinkStepBuilder struct { res *model.SinkStep diff --git a/builders/source.go b/builders/source.go index 2cb84f4..9798b4b 100644 --- a/builders/source.go +++ b/builders/source.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type SourceStepBuilder struct { res *model.SourceStep diff --git a/builders/steps.go b/builders/steps.go index 791b9e5..1bc497c 100644 --- a/builders/steps.go +++ b/builders/steps.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type StepsBuilder struct { steps *model.Steps diff --git a/builders/transformer.go b/builders/transformer.go index 649985b..f0c60fd 100644 --- a/builders/transformer.go +++ b/builders/transformer.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type TransformerStepBuilder struct { res *model.TransformerStep diff --git a/builders/transformer_combine.go b/builders/transformer_combine.go index 391e152..a3c808a 100644 --- a/builders/transformer_combine.go +++ b/builders/transformer_combine.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type CombineTransformerStepBuilder struct { res *model.CombineTransformerStep diff --git a/builders/transformer_composite.go b/builders/transformer_composite.go index 87879d5..87c4efe 100644 --- a/builders/transformer_composite.go +++ b/builders/transformer_composite.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type CompositeTransformerStepBuilder struct { res *model.CompositeTransformerStep diff --git a/builders/transformer_explode.go b/builders/transformer_explode.go index 757249d..26611c0 100644 --- a/builders/transformer_explode.go +++ b/builders/transformer_explode.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type ExplodeTransformerStepBuilder struct { res *model.ExplodeTransformerStep diff --git a/builders/transformer_mapping.go b/builders/transformer_mapping.go index 5fdeefe..071dc85 100644 --- a/builders/transformer_mapping.go +++ b/builders/transformer_mapping.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type MappingTransformerStepBuilder struct { res *model.MappingTransformerStep diff --git a/builders/transformer_service.go b/builders/transformer_service.go index ac42bb1..dcdb43f 100644 --- a/builders/transformer_service.go +++ b/builders/transformer_service.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/model" +import "github.com/synadia-io/connect/model" type ServiceTransformerStepBuilder struct { res *model.ServiceTransformerStep diff --git a/builders/transformer_test.go b/builders/transformer_test.go index 1c840b2..742b892 100644 --- a/builders/transformer_test.go +++ b/builders/transformer_test.go @@ -3,7 +3,7 @@ package builders import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" ) var _ = Describe("TransformerStepBuilder", func() { diff --git a/cli/connector_command.go b/cli/connector_command.go index 778e87d..60f14cb 100644 --- a/cli/connector_command.go +++ b/cli/connector_command.go @@ -9,9 +9,9 @@ import ( "github.com/jedib0t/go-pretty/v6/text" "github.com/joho/godotenv" - "github.com/synadia-io/connect/v2/client" - "github.com/synadia-io/connect/v2/convert" - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/client" + "github.com/synadia-io/connect/convert" + "github.com/synadia-io/connect/spec" "github.com/AlecAivazis/survey/v2" "github.com/choria-io/fisk" @@ -19,7 +19,7 @@ import ( "github.com/fatih/color" "github.com/jedib0t/go-pretty/v6/table" "github.com/mitchellh/mapstructure" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" "gopkg.in/yaml.v3" ) @@ -341,10 +341,9 @@ func (c *connectorCommand) saveConnector(pc *fisk.ParseContext) error { var sp spec.ConnectorSpec if exists { sp = spec.ConnectorSpec{ - Description: conn.Description, - RuntimeId: conn.RuntimeId, - RuntimeVersion: &conn.RuntimeVersion, - Steps: convert.ConvertStepsToSpec(conn.Steps), + Description: conn.Description, + RuntimeId: conn.RuntimeId, + Steps: convert.ConvertStepsToSpec(conn.Steps), } } else { if !c.fileSetByUser { @@ -371,11 +370,7 @@ func (c *connectorCommand) saveConnector(pc *fisk.ParseContext) error { var connector *model.Connector if !exists { - runtimeVersion := "" - if result.RuntimeVersion != nil { - runtimeVersion = *result.RuntimeVersion - } - connector, err = appCtx.Client.CreateConnector(c.id, result.Description, result.RuntimeId, runtimeVersion, convert.ConvertStepsFromSpec(result.Steps), c.opts.Timeout) + connector, err = appCtx.Client.CreateConnector(c.id, result.Description, result.RuntimeId, convert.ConvertStepsFromSpec(result.Steps), c.opts.Timeout) if err != nil { color.Red("Could not save connector: %s", err) os.Exit(1) @@ -430,7 +425,7 @@ func (c *connectorCommand) copyConnector(context *fisk.ParseContext) error { return nil } - _, err = appCtx.Client.CreateConnector(c.targetId, conn.Description, conn.RuntimeId, conn.RuntimeVersion, convert.ConvertStepsFromSpec(convert.ConvertStepsToSpec(conn.Steps)), c.opts.Timeout) + _, err = appCtx.Client.CreateConnector(c.targetId, conn.Description, conn.RuntimeId, convert.ConvertStepsFromSpec(convert.ConvertStepsToSpec(conn.Steps)), c.opts.Timeout) fisk.FatalIfError(err, "failed to create connector %s: %v", c.targetId, err) fmt.Printf("Created connector %s\n", color.GreenString(c.targetId)) @@ -515,6 +510,14 @@ func fromEditor(existing *spec.ConnectorSpec) (*spec.ConnectorSpec, bool, error) } func (c *connectorCommand) selectConnectorTemplate(cl client.Client) (*spec.ConnectorSpec, error) { + rt, err := cl.GetRuntime(c.runtime, 5*time.Second) + if err != nil { + return nil, fmt.Errorf("could not get runtime: %s", err) + } + if rt == nil { + return nil, fmt.Errorf("runtime %s not found", c.runtime) + } + var options []string mapping := make(map[string]spec.ConnectorSpec) for _, template := range templates { @@ -523,7 +526,7 @@ func (c *connectorCommand) selectConnectorTemplate(cl client.Client) (*spec.Conn } choice := "" - err := survey.AskOne(&survey.Select{ + err = survey.AskOne(&survey.Select{ Message: "Connector Template", Options: options, }, &choice, survey.WithValidator(survey.Required)) diff --git a/cli/connector_command_helpers.go b/cli/connector_command_helpers.go index 5751ced..afaae00 100644 --- a/cli/connector_command_helpers.go +++ b/cli/connector_command_helpers.go @@ -7,7 +7,7 @@ import ( "github.com/fatih/color" "github.com/jedib0t/go-pretty/v6/table" "github.com/jedib0t/go-pretty/v6/text" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" ) // These are testable helper functions that can be called with a provided AppContext @@ -142,7 +142,7 @@ func (c *connectorCommand) copyConnectorWithClient(appCtx *AppContext) error { } // Create the copy - copied, err := appCtx.Client.CreateConnector(c.targetId, connector.Description, connector.RuntimeId, connector.RuntimeVersion, connector.Steps, c.opts.Timeout) + copied, err := appCtx.Client.CreateConnector(c.targetId, connector.Description, connector.RuntimeId, connector.Steps, c.opts.Timeout) if err != nil { return fmt.Errorf("failed to create connector copy: %w", err) } diff --git a/cli/connector_command_test.go b/cli/connector_command_test.go index 63af134..339c07a 100644 --- a/cli/connector_command_test.go +++ b/cli/connector_command_test.go @@ -6,7 +6,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" ) var _ = Describe("ConnectorCommand", func() { @@ -264,10 +264,9 @@ var _ = Describe("ConnectorCommand", func() { It("should copy a connector", func() { // First it gets the source connector mockCl.connector = &model.Connector{ - ConnectorId: "source-connector", - Description: "Source Connector", - RuntimeId: "synadia", - RuntimeVersion: "v1.0.0", + ConnectorId: "source-connector", + Description: "Source Connector", + RuntimeId: "synadia", Steps: model.Steps{ Source: &model.SourceStep{ Type: "generate", diff --git a/cli/library_command.go b/cli/library_command.go index 1f993d8..53354b9 100644 --- a/cli/library_command.go +++ b/cli/library_command.go @@ -7,7 +7,7 @@ import ( "github.com/fatih/color" "github.com/jedib0t/go-pretty/v6/table" "github.com/jedib0t/go-pretty/v6/text" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" "os" "strings" @@ -18,11 +18,10 @@ import ( type libraryCommand struct { opts *Options - runtime string - kind string - status string - component string - runtimeVersion string + runtime string + kind string + status string + component string } func ConfigureLibraryCommand(parentCmd commandHost, opts *Options) { @@ -39,14 +38,9 @@ func ConfigureLibraryCommand(parentCmd commandHost, opts *Options) { runtimeCmd := componentCmd.Command("runtime", "Show information about a runtime").Action(c.getRuntime) runtimeCmd.Arg("id", "The id of the runtime to describe").Required().StringVar(&c.runtime) - runtimeCmd.Flag("runtime-version", "The runtime version").Required().StringVar(&c.runtimeVersion) - - versionsCmd := componentCmd.Command("versions", "List versions of a runtime").Action(c.listRuntimeVersions) - versionsCmd.Arg("id", "The runtime id").Required().StringVar(&c.runtime) searchCmd := componentCmd.Command("list", "List components").Alias("ls").Action(c.search) searchCmd.Flag("runtime", "The runtime id").StringVar(&c.runtime) - searchCmd.Flag("runtime-version", "The runtime version").StringVar(&c.runtimeVersion) searchCmd.Flag("kind", "The kind of components").EnumVar(&c.kind, kindOpts...) searchCmd.Flag("status", "The status of the components").EnumVar(&c.status, statusOpts...) @@ -54,7 +48,6 @@ func ConfigureLibraryCommand(parentCmd commandHost, opts *Options) { infoCmd.Arg("runtime", "The runtime id").StringVar(&c.runtime) infoCmd.Arg("kind", "The kind of component").EnumVar(&c.kind, kindOpts...) infoCmd.Arg("name", "The name of the component").StringVar(&c.component) - infoCmd.Flag("runtime-version", "The runtime version").Required().StringVar(&c.runtimeVersion) } func (c *libraryCommand) listRuntimes(pc *fisk.ParseContext) error { @@ -63,7 +56,7 @@ func (c *libraryCommand) listRuntimes(pc *fisk.ParseContext) error { defer appCtx.Close() w := table.NewWriter() - w.AppendHeader(table.Row{"Id", "Version", "Name", "Description", "Author"}) + w.AppendHeader(table.Row{"Id", "Name", "Description", "Author"}) w.SetStyle(table.StyleRounded) runtimes, err := appCtx.Client.ListRuntimes(c.opts.Timeout) @@ -77,8 +70,7 @@ func (c *libraryCommand) listRuntimes(pc *fisk.ParseContext) error { if runtime.Description != nil { desc = *runtime.Description } - version := runtime.Version - w.AppendRow(table.Row{runtime.Id, version, runtime.Label, desc, runtime.Author.Name}) + w.AppendRow(table.Row{runtime.Id, runtime.Label, desc, runtime.Author}) } result := w.Render() @@ -91,7 +83,7 @@ func (c *libraryCommand) getRuntime(pc *fisk.ParseContext) error { fisk.FatalIfError(err, "failed to load options") defer appCtx.Close() - rt, err := appCtx.Client.GetRuntime(c.runtime, &c.runtimeVersion, c.opts.Timeout) + rt, err := appCtx.Client.GetRuntime(c.runtime, c.opts.Timeout) if err != nil { color.Red("Could not get runtime: %s", err) os.Exit(1) @@ -107,50 +99,13 @@ func (c *libraryCommand) getRuntime(pc *fisk.ParseContext) error { return nil } -func (c *libraryCommand) listRuntimeVersions(pc *fisk.ParseContext) error { - appCtx, err := LoadOptions(c.opts) - fisk.FatalIfError(err, "failed to load options") - defer appCtx.Close() - - runtimes, err := appCtx.Client.ListRuntimes(c.opts.Timeout) - if err != nil { - color.Red("Could not list runtimes: %s", err) - os.Exit(1) - } - - var versions []string - for _, runtime := range runtimes { - if runtime.Id == c.runtime { - versions = append(versions, runtime.Version) - } - } - - if len(versions) == 0 { - color.Red("No versions found for runtime '%s'", c.runtime) - os.Exit(1) - } - - fmt.Printf("Available versions for runtime '%s':\n", c.runtime) - w := table.NewWriter() - w.AppendHeader(table.Row{"Version"}) - w.SetStyle(table.StyleRounded) - - for _, version := range versions { - w.AppendRow(table.Row{version}) - } - - result := w.Render() - fmt.Println(result) - return nil -} - func (c *libraryCommand) search(pc *fisk.ParseContext) error { appCtx, err := LoadOptions(c.opts) fisk.FatalIfError(err, "failed to load options") defer appCtx.Close() w := table.NewWriter() - w.AppendHeader(table.Row{"Name", "Kind", "Runtime", "Version", "Status"}) + w.AppendHeader(table.Row{"Name", "Kind", "Runtime", "Status"}) w.SetStyle(table.StyleRounded) filter := &model.ComponentSearchFilter{} @@ -169,10 +124,6 @@ func (c *libraryCommand) search(pc *fisk.ParseContext) error { filter.Kind = &k } - if c.runtimeVersion != "" { - filter.RuntimeVersion = &c.runtimeVersion - } - components, err := appCtx.Client.SearchComponents(filter, c.opts.Timeout) if err != nil { color.Red("Could not list components: %s", err) @@ -180,7 +131,7 @@ func (c *libraryCommand) search(pc *fisk.ParseContext) error { } for _, component := range components { - w.AppendRow(table.Row{component.Name, component.Kind, component.RuntimeId, component.RuntimeVersion, component.Status}) + w.AppendRow(table.Row{component.Name, component.Kind, component.RuntimeId, component.Status}) } result := w.Render() @@ -193,7 +144,7 @@ func (c *libraryCommand) info(pc *fisk.ParseContext) error { fisk.FatalIfError(err, "failed to load options") defer appCtx.Close() - component, err := appCtx.Client.GetComponent(c.runtime, c.runtimeVersion, model.ComponentKind(c.kind), c.component, c.opts.Timeout) + component, err := appCtx.Client.GetComponent(c.runtime, model.ComponentKind(c.kind), c.component, c.opts.Timeout) if err != nil { color.Red("Could not get component: %s", err) os.Exit(1) @@ -204,7 +155,6 @@ func (c *libraryCommand) info(pc *fisk.ParseContext) error { w.SetStyle(table.StyleRounded) w.SetTitle("Component Description") w.AppendRow(table.Row{"Runtime", component.RuntimeId}) - w.AppendRow(table.Row{"Runtime Version", component.RuntimeVersion}) w.AppendRow(table.Row{"Name", component.Name}) w.AppendRow(table.Row{"Kind", component.Kind}) w.AppendRow(table.Row{"Status", component.Status}) diff --git a/cli/library_command_helpers.go b/cli/library_command_helpers.go index 2df29fd..3af93f6 100644 --- a/cli/library_command_helpers.go +++ b/cli/library_command_helpers.go @@ -5,7 +5,7 @@ import ( "github.com/jedib0t/go-pretty/v6/table" "github.com/jedib0t/go-pretty/v6/text" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" ) // These are testable helper functions that can be called with a provided AppContext @@ -17,7 +17,7 @@ func (c *libraryCommand) listRuntimesWithClient(appCtx *AppContext) error { } w := table.NewWriter() - w.AppendHeader(table.Row{"Id", "Version", "Name", "Description", "Author"}) + w.AppendHeader(table.Row{"Id", "Name", "Description", "Author"}) w.SetStyle(table.StyleRounded) for _, runtime := range runtimes { @@ -25,8 +25,7 @@ func (c *libraryCommand) listRuntimesWithClient(appCtx *AppContext) error { if runtime.Description != nil { desc = *runtime.Description } - version := runtime.Version - w.AppendRow(table.Row{runtime.Id, version, runtime.Label, desc, runtime.Author.Name}) + w.AppendRow(table.Row{runtime.Id, runtime.Label, desc, runtime.Author}) } result := w.Render() @@ -35,7 +34,7 @@ func (c *libraryCommand) listRuntimesWithClient(appCtx *AppContext) error { } func (c *libraryCommand) getRuntimeWithClient(appCtx *AppContext) error { - rt, err := appCtx.Client.GetRuntime(c.runtime, &c.runtimeVersion, c.opts.Timeout) + rt, err := appCtx.Client.GetRuntime(c.runtime, c.opts.Timeout) if err != nil { return fmt.Errorf("could not get runtime: %w", err) } @@ -67,21 +66,17 @@ func (c *libraryCommand) searchWithClient(appCtx *AppContext) error { filter.Kind = &k } - if c.runtimeVersion != "" { - filter.RuntimeVersion = &c.runtimeVersion - } - components, err := appCtx.Client.SearchComponents(filter, c.opts.Timeout) if err != nil { return fmt.Errorf("could not list components: %w", err) } w := table.NewWriter() - w.AppendHeader(table.Row{"Name", "Kind", "Runtime", "Version", "Status"}) + w.AppendHeader(table.Row{"Name", "Kind", "Runtime", "Status"}) w.SetStyle(table.StyleRounded) for _, component := range components { - w.AppendRow(table.Row{component.Name, component.Kind, component.RuntimeId, component.RuntimeVersion, component.Status}) + w.AppendRow(table.Row{component.Name, component.Kind, component.RuntimeId, component.Status}) } result := w.Render() @@ -90,7 +85,7 @@ func (c *libraryCommand) searchWithClient(appCtx *AppContext) error { } func (c *libraryCommand) infoWithClient(appCtx *AppContext) error { - component, err := appCtx.Client.GetComponent(c.runtime, c.runtimeVersion, model.ComponentKind(c.kind), c.component, c.opts.Timeout) + component, err := appCtx.Client.GetComponent(c.runtime, model.ComponentKind(c.kind), c.component, c.opts.Timeout) if err != nil { return fmt.Errorf("could not get component: %w", err) } @@ -106,7 +101,6 @@ func (c *libraryCommand) infoWithClient(appCtx *AppContext) error { w.SetStyle(table.StyleRounded) w.SetTitle("Component Description") w.AppendRow(table.Row{"Runtime", component.RuntimeId}) - w.AppendRow(table.Row{"Runtime Version", component.RuntimeVersion}) w.AppendRow(table.Row{"Name", component.Name}) w.AppendRow(table.Row{"Kind", component.Kind}) w.AppendRow(table.Row{"Status", component.Status}) diff --git a/cli/library_command_test.go b/cli/library_command_test.go index 97db229..481993f 100644 --- a/cli/library_command_test.go +++ b/cli/library_command_test.go @@ -3,7 +3,7 @@ package cli import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" ) var _ = Describe("LibraryCommand", func() { diff --git a/cli/options.go b/cli/options.go index cb6993b..a6e42f6 100644 --- a/cli/options.go +++ b/cli/options.go @@ -8,7 +8,7 @@ import ( "github.com/choria-io/fisk" "github.com/nats-io/jsm.go/natscontext" "github.com/nats-io/nats.go" - "github.com/synadia-io/connect/v2/client" + "github.com/synadia-io/connect/client" ) var DefaultOptions *Options diff --git a/cli/render.go b/cli/render.go index 6228b18..c92decd 100644 --- a/cli/render.go +++ b/cli/render.go @@ -5,7 +5,7 @@ import ( "github.com/choria-io/fisk" "github.com/jedib0t/go-pretty/v6/text" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" "github.com/fatih/color" "github.com/jedib0t/go-pretty/v6/table" @@ -33,11 +33,7 @@ func renderConnector(c model.Connector) string { tbl.SetTitle(fmt.Sprintf("Connector: %s", c.ConnectorId)) tbl.AppendRow(table.Row{"Description", text.WrapSoft(c.Description, 50)}) - runtime := c.RuntimeId - if c.RuntimeVersion != "" { - runtime = fmt.Sprintf("%s:%s", c.RuntimeId, c.RuntimeVersion) - } - tbl.AppendRow(table.Row{"Runtime", runtime}) + tbl.AppendRow(table.Row{"Runtime", c.RuntimeId}) b, err := yaml.Marshal(c.Steps) fisk.FatalIfError(err, "failed to render steps") @@ -55,10 +51,6 @@ func renderRuntime(rt model.Runtime) string { tbl.SetTitle(rt.Label) tbl.AppendRow(table.Row{"Id", rt.Id}) - if rt.Version != "" { - tbl.AppendRow(table.Row{"Version", rt.Version}) - } - if rt.Description != nil { tbl.AppendRow(table.Row{"Description", text.WrapSoft(*rt.Description, 50)}) } diff --git a/cli/render_test.go b/cli/render_test.go index b3f7688..2e83259 100644 --- a/cli/render_test.go +++ b/cli/render_test.go @@ -3,7 +3,7 @@ package cli import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" ) var _ = Describe("Render", func() { diff --git a/cli/standalone.go b/cli/standalone.go index 710a2e0..47c8961 100644 --- a/cli/standalone.go +++ b/cli/standalone.go @@ -9,10 +9,10 @@ import ( "github.com/fatih/color" "github.com/jedib0t/go-pretty/v6/table" "github.com/jedib0t/go-pretty/v6/text" - "github.com/synadia-io/connect/v2/convert" - "github.com/synadia-io/connect/v2/docker" - "github.com/synadia-io/connect/v2/standalone" - "github.com/synadia-io/connect/v2/validation" + "github.com/synadia-io/connect/convert" + "github.com/synadia-io/connect/docker" + "github.com/synadia-io/connect/standalone" + "github.com/synadia-io/connect/validation" "golang.org/x/text/cases" "golang.org/x/text/language" ) diff --git a/cli/standalone_helpers.go b/cli/standalone_helpers.go index 2db40c3..5f1ed30 100644 --- a/cli/standalone_helpers.go +++ b/cli/standalone_helpers.go @@ -6,8 +6,8 @@ import ( "strings" "github.com/mitchellh/mapstructure" - "github.com/synadia-io/connect/v2/spec" - "github.com/synadia-io/connect/v2/spec/builders" + "github.com/synadia-io/connect/spec" + "github.com/synadia-io/connect/spec/builders" "gopkg.in/yaml.v3" ) diff --git a/cli/templates.go b/cli/templates.go index 09a8899..26ef6fe 100644 --- a/cli/templates.go +++ b/cli/templates.go @@ -1,8 +1,8 @@ package cli import ( - "github.com/synadia-io/connect/v2/spec" - "github.com/synadia-io/connect/v2/spec/builders" + "github.com/synadia-io/connect/spec" + "github.com/synadia-io/connect/spec/builders" ) var templates = []spec.ConnectorSpec{ diff --git a/cli/test_helpers_test.go b/cli/test_helpers_test.go index b4f7a50..cb92e81 100644 --- a/cli/test_helpers_test.go +++ b/cli/test_helpers_test.go @@ -3,7 +3,7 @@ package cli import ( "time" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" ) // mockClient implements the client.Client interface for testing @@ -70,7 +70,7 @@ func (m *mockClient) GetConnectorStatus(id string, timeout time.Duration) (*mode return m.connectorStatus, nil } -func (m *mockClient) CreateConnector(id, description, runtimeId string, runtimeVersion string, steps model.Steps, timeout time.Duration) (*model.Connector, error) { +func (m *mockClient) CreateConnector(id, description, runtimeId string, steps model.Steps, timeout time.Duration) (*model.Connector, error) { m.createCalled = true if m.connectorError != nil { return nil, m.connectorError @@ -120,7 +120,7 @@ func (m *mockClient) ListRuntimes(timeout time.Duration) ([]model.RuntimeSummary return m.runtimes, nil } -func (m *mockClient) GetRuntime(id string, version *string, timeout time.Duration) (*model.Runtime, error) { +func (m *mockClient) GetRuntime(id string, timeout time.Duration) (*model.Runtime, error) { return m.runtime, nil } @@ -128,7 +128,7 @@ func (m *mockClient) SearchComponents(filter *model.ComponentSearchFilter, timeo return m.components, nil } -func (m *mockClient) GetComponent(runtimeId string, runtimeVersion string, kind model.ComponentKind, id string, timeout time.Duration) (*model.Component, error) { +func (m *mockClient) GetComponent(runtimeId string, kind model.ComponentKind, id string, timeout time.Duration) (*model.Component, error) { return m.component, nil } diff --git a/client/client.go b/client/client.go index 687ebdc..87eb8d3 100644 --- a/client/client.go +++ b/client/client.go @@ -4,7 +4,7 @@ import ( "time" "github.com/nats-io/nats.go" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" ) type Client interface { @@ -20,7 +20,7 @@ type ConnectorClient interface { ListConnectors(timeout time.Duration) ([]model.ConnectorSummary, error) GetConnector(id string, timeout time.Duration) (*model.Connector, error) GetConnectorStatus(id string, timeout time.Duration) (*model.ConnectorStatus, error) - CreateConnector(id, description, runtimeId string, runtimeVersion string, steps model.Steps, timeout time.Duration) (*model.Connector, error) + CreateConnector(id, description, runtimeId string, steps model.Steps, timeout time.Duration) (*model.Connector, error) PatchConnector(id string, patch string, timeout time.Duration) (*model.Connector, error) DeleteConnector(id string, timeout time.Duration) error @@ -31,10 +31,10 @@ type ConnectorClient interface { type LibraryClient interface { ListRuntimes(timeout time.Duration) ([]model.RuntimeSummary, error) - GetRuntime(id string, version *string, timeout time.Duration) (*model.Runtime, error) + GetRuntime(id string, timeout time.Duration) (*model.Runtime, error) SearchComponents(filter *model.ComponentSearchFilter, timeout time.Duration) ([]model.ComponentSummary, error) - GetComponent(runtimeId string, runtimeVersion string, kind model.ComponentKind, id string, timeout time.Duration) (*model.Component, error) + GetComponent(runtimeId string, kind model.ComponentKind, id string, timeout time.Duration) (*model.Component, error) } func NewClient(nc *nats.Conn, trace bool) (Client, error) { diff --git a/client/connector.go b/client/connector.go index 8bc56e8..28ba8b5 100644 --- a/client/connector.go +++ b/client/connector.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" ) type connectorClient struct { @@ -74,7 +74,7 @@ func (c *connectorClient) GetConnectorStatus(name string, timeout time.Duration) return &resp.Status, nil } -func (c *connectorClient) CreateConnector(id, description, runtimeId string, runtimeVersion string, steps model.Steps, timeout time.Duration) (*model.Connector, error) { +func (c *connectorClient) CreateConnector(id, description, runtimeId string, steps model.Steps, timeout time.Duration) (*model.Connector, error) { req := model.ConnectorCreateRequest{ Id: id, Description: description, @@ -82,10 +82,6 @@ func (c *connectorClient) CreateConnector(id, description, runtimeId string, run Steps: steps, } - if runtimeVersion != "" { - req.RuntimeVersion = &runtimeVersion - } - var resp model.ConnectorCreateResponse gotResponse, err := c.t.RequestJson(c.subject("CREATE"), req, &resp, WithTimeout(timeout)) if err != nil { diff --git a/client/library.go b/client/library.go index 8c8c787..a50eb7d 100644 --- a/client/library.go +++ b/client/library.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" ) type libraryEntityKind string @@ -37,13 +37,9 @@ func (c *libraryClient) ListRuntimes(timeout time.Duration) ([]model.RuntimeSumm return resp.Runtimes, nil } -func (c *libraryClient) GetRuntime(id string, version *string, timeout time.Duration) (*model.Runtime, error) { - if version == nil { - return nil, fmt.Errorf("runtime version is required - use --runtime-version flag") - } +func (c *libraryClient) GetRuntime(id string, timeout time.Duration) (*model.Runtime, error) { req := model.RuntimeGetRequest{ - Name: id, - Version: *version, + Name: id, } var resp model.RuntimeGetResponse gotResponse, err := c.t.RequestJson(c.subject(runtimes, "GET"), req, &resp, WithTimeout(timeout)) @@ -76,12 +72,11 @@ func (c *libraryClient) SearchComponents(filter *model.ComponentSearchFilter, ti return resp.Components, nil } -func (c *libraryClient) GetComponent(runtimeId string, runtimeVersion string, kind model.ComponentKind, id string, timeout time.Duration) (*model.Component, error) { +func (c *libraryClient) GetComponent(runtimeId string, kind model.ComponentKind, id string, timeout time.Duration) (*model.Component, error) { req := model.ComponentGetRequest{ - RuntimeId: runtimeId, - Kind: kind, - Name: id, - RuntimeVersion: &runtimeVersion, + RuntimeId: runtimeId, + Kind: kind, + Name: id, } var resp model.ComponentGetResponse diff --git a/client/library_test.go b/client/library_test.go index b6f00f1..49573d1 100644 --- a/client/library_test.go +++ b/client/library_test.go @@ -4,7 +4,7 @@ import ( "github.com/nats-io/nats.go" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" ) var _ = Describe("LibraryClient", func() { diff --git a/cmd/connect/main.go b/cmd/connect/main.go index 476c595..ec0fb9b 100644 --- a/cmd/connect/main.go +++ b/cmd/connect/main.go @@ -5,7 +5,7 @@ import ( "time" "github.com/choria-io/fisk" - "github.com/synadia-io/connect/v2/cli" + "github.com/synadia-io/connect/cli" ) var opts *cli.Options diff --git a/convert/from_spec.go b/convert/from_spec.go index da79606..b35ec58 100644 --- a/convert/from_spec.go +++ b/convert/from_spec.go @@ -1,8 +1,8 @@ package convert import ( - "github.com/synadia-io/connect/v2/model" - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/model" + "github.com/synadia-io/connect/spec" ) func ConvertStepsFromSpec(sp spec.StepsSpec) model.Steps { diff --git a/convert/to_spec.go b/convert/to_spec.go index e545b96..943c2a8 100644 --- a/convert/to_spec.go +++ b/convert/to_spec.go @@ -1,8 +1,8 @@ package convert import ( - "github.com/synadia-io/connect/v2/model" - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/model" + "github.com/synadia-io/connect/spec" ) func ConvertStepsToSpec(steps model.Steps) spec.StepsSpec { diff --git a/docker/runner.go b/docker/runner.go index 51f893f..0d547f5 100644 --- a/docker/runner.go +++ b/docker/runner.go @@ -10,7 +10,7 @@ import ( "path/filepath" "strings" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" "gopkg.in/yaml.v3" ) diff --git a/go.mod b/go.mod index b4fd8db..6249340 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/synadia-io/connect/v2 +module github.com/synadia-io/connect go 1.24 @@ -48,3 +48,5 @@ require ( golang.org/x/time v0.12.0 // indirect golang.org/x/tools v0.34.0 // indirect ) + +retract [v1.0.3, v1.0.6] // Checksum poisoned diff --git a/model/connector_create.go b/model/connector_create.go index 91bf892..1802b30 100644 --- a/model/connector_create.go +++ b/model/connector_create.go @@ -2,8 +2,10 @@ package model -import "encoding/json" -import "fmt" +import ( + "encoding/json" + "fmt" +) type ConnectorCreateRequest struct { // A description of the connector @@ -15,9 +17,6 @@ type ConnectorCreateRequest struct { // The connector runtime RuntimeId string `json:"runtime_id" yaml:"runtime_id" mapstructure:"runtime_id"` - // The version of the runtime (optional, for backwards compatibility) - RuntimeVersion *string `json:"runtime_version,omitempty" yaml:"runtime_version,omitempty" mapstructure:"runtime_version,omitempty"` - // Steps corresponds to the JSON schema field "steps". Steps Steps `json:"steps" yaml:"steps" mapstructure:"steps"` } diff --git a/model/connector_delete.go b/model/connector_delete.go index 579b8fa..5c38a35 100644 --- a/model/connector_delete.go +++ b/model/connector_delete.go @@ -2,8 +2,10 @@ package model -import "encoding/json" -import "fmt" +import ( + "encoding/json" + "fmt" +) type ConnectorDeleteRequest struct { // The id of the connector to remove diff --git a/model/connector_get.go b/model/connector_get.go index 3e00e92..dfb08eb 100644 --- a/model/connector_get.go +++ b/model/connector_get.go @@ -2,8 +2,10 @@ package model -import "encoding/json" -import "fmt" +import ( + "encoding/json" + "fmt" +) type ConnectorGetRequest struct { // The id of the connector to get diff --git a/model/connector_instances.go b/model/connector_instances.go index 78135be..3d03712 100644 --- a/model/connector_instances.go +++ b/model/connector_instances.go @@ -2,8 +2,10 @@ package model -import "encoding/json" -import "fmt" +import ( + "encoding/json" + "fmt" +) type ConnectorInstancesRequest struct { // The id of the connector to get instances for diff --git a/model/connector_models.go b/model/connector_models.go index 18255e4..044a320 100644 --- a/model/connector_models.go +++ b/model/connector_models.go @@ -2,9 +2,11 @@ package model -import "encoding/json" -import "fmt" -import "reflect" +import ( + "encoding/json" + "fmt" + "reflect" +) // Combine all messages in the batch into a single message type CombineTransformerStep struct { @@ -105,9 +107,6 @@ type Connector struct { // The id of the connector's runtime RuntimeId string `json:"runtime_id" yaml:"runtime_id" mapstructure:"runtime_id"` - // The version of the connector's runtime - RuntimeVersion string `json:"runtime_version" yaml:"runtime_version" mapstructure:"runtime_version"` - // Steps corresponds to the JSON schema field "steps". Steps Steps `json:"steps" yaml:"steps" mapstructure:"steps"` } @@ -315,9 +314,6 @@ func (j *Connector) UnmarshalJSON(value []byte) error { if _, ok := raw["runtime_id"]; raw != nil && !ok { return fmt.Errorf("field runtime_id in Connector: required") } - if _, ok := raw["runtime_version"]; raw != nil && !ok { - return fmt.Errorf("field runtime_version in Connector: required") - } if _, ok := raw["steps"]; raw != nil && !ok { return fmt.Errorf("field steps in Connector: required") } diff --git a/model/connector_patch.go b/model/connector_patch.go index 30c1c90..9429f92 100644 --- a/model/connector_patch.go +++ b/model/connector_patch.go @@ -2,8 +2,10 @@ package model -import "encoding/json" -import "fmt" +import ( + "encoding/json" + "fmt" +) type ConnectorPatchRequest struct { // The id of the connector to patch diff --git a/model/connector_start.go b/model/connector_start.go index 6af9094..76c5526 100644 --- a/model/connector_start.go +++ b/model/connector_start.go @@ -2,8 +2,10 @@ package model -import "encoding/json" -import "fmt" +import ( + "encoding/json" + "fmt" +) type ConnectorStartRequest struct { // The id of the connector diff --git a/model/connector_status.go b/model/connector_status.go index dd74c60..21e3ed8 100644 --- a/model/connector_status.go +++ b/model/connector_status.go @@ -2,8 +2,10 @@ package model -import "encoding/json" -import "fmt" +import ( + "encoding/json" + "fmt" +) type ConnectorStatusRequest struct { // The id of the connector to get the status for diff --git a/model/connector_stop.go b/model/connector_stop.go index cc47397..65d8b96 100644 --- a/model/connector_stop.go +++ b/model/connector_stop.go @@ -2,8 +2,10 @@ package model -import "encoding/json" -import "fmt" +import ( + "encoding/json" + "fmt" +) type ConnectorStopRequest struct { // The id of the connector to stop diff --git a/model/crawler.go b/model/crawler.go index 6bcedcb..67d3266 100644 --- a/model/crawler.go +++ b/model/crawler.go @@ -2,10 +2,12 @@ package model -import "encoding/json" -import "fmt" -import "reflect" -import "regexp" +import ( + "encoding/json" + "fmt" + "reflect" + "regexp" +) type AuthorSpec struct { // The email address of the author @@ -357,6 +359,9 @@ type RuntimeSpec struct { // Author corresponds to the JSON schema field "author". Author AuthorSpec `json:"author" yaml:"author" mapstructure:"author"` + // The default version of the runtime + DefaultVersion string `json:"default_version" yaml:"default_version" mapstructure:"default_version"` + // A description of the runtime Description string `json:"description" yaml:"description" mapstructure:"description"` @@ -371,9 +376,6 @@ type RuntimeSpec struct { // The unique identifier of the runtime Name string `json:"name" yaml:"name" mapstructure:"name"` - - // The version of this runtime definition - Version string `json:"version" yaml:"version" mapstructure:"version"` } // UnmarshalJSON implements json.Unmarshaler. @@ -397,14 +399,14 @@ func (j *RuntimeSpec) UnmarshalJSON(value []byte) error { if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in RuntimeSpec: required") } - if _, ok := raw["version"]; raw != nil && !ok { - return fmt.Errorf("field version in RuntimeSpec: required") - } type Plain RuntimeSpec var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } + if v, ok := raw["default_version"]; !ok || v == nil { + plain.DefaultVersion = "latest" + } *j = RuntimeSpec(plain) return nil } diff --git a/model/library.go b/model/library.go index f1939c9..4df62d9 100644 --- a/model/library.go +++ b/model/library.go @@ -2,10 +2,12 @@ package model -import "encoding/json" -import "fmt" -import "reflect" -import "regexp" +import ( + "encoding/json" + "fmt" + "reflect" + "regexp" +) type Component struct { // A description of the component @@ -30,9 +32,6 @@ type Component struct { // The unique identifier of the runtime to which this component belongs RuntimeId string `json:"runtime_id" yaml:"runtime_id" mapstructure:"runtime_id"` - // The version of the runtime this component belongs to - RuntimeVersion string `json:"runtime_version" yaml:"runtime_version" mapstructure:"runtime_version"` - // Status corresponds to the JSON schema field "status". Status ComponentStatus `json:"status" yaml:"status" mapstructure:"status"` } @@ -221,10 +220,6 @@ type ComponentGetRequest struct { // The unique identifier of the runtime to which this component belongs RuntimeId string `json:"runtime_id" yaml:"runtime_id" mapstructure:"runtime_id"` - - // The version of the runtime to query (optional, defaults to most recent runtime - // version) - RuntimeVersion *string `json:"runtime_version,omitempty" yaml:"runtime_version,omitempty" mapstructure:"runtime_version,omitempty"` } // UnmarshalJSON implements json.Unmarshaler. @@ -319,9 +314,6 @@ type ComponentSearchFilter struct { // The unique identifier of the runtime RuntimeId *string `json:"runtime_id,omitempty" yaml:"runtime_id,omitempty" mapstructure:"runtime_id,omitempty"` - // The version of the runtime to filter by (optional, defaults to latest version) - RuntimeVersion *string `json:"runtime_version,omitempty" yaml:"runtime_version,omitempty" mapstructure:"runtime_version,omitempty"` - // Status corresponds to the JSON schema field "status". Status *ComponentStatus `json:"status,omitempty" yaml:"status,omitempty" mapstructure:"status,omitempty"` } @@ -390,9 +382,6 @@ type ComponentSummary struct { // The unique identifier of the runtime to which this component belongs RuntimeId string `json:"runtime_id" yaml:"runtime_id" mapstructure:"runtime_id"` - // The version of the runtime this component belongs to - RuntimeVersion string `json:"runtime_version" yaml:"runtime_version" mapstructure:"runtime_version"` - // Status corresponds to the JSON schema field "status". Status ComponentStatus `json:"status" yaml:"status" mapstructure:"status"` } @@ -415,9 +404,6 @@ func (j *ComponentSummary) UnmarshalJSON(value []byte) error { if _, ok := raw["runtime_id"]; raw != nil && !ok { return fmt.Errorf("field runtime_id in ComponentSummary: required") } - if _, ok := raw["runtime_version"]; raw != nil && !ok { - return fmt.Errorf("field runtime_version in ComponentSummary: required") - } if _, ok := raw["status"]; raw != nil && !ok { return fmt.Errorf("field status in ComponentSummary: required") } @@ -451,9 +437,6 @@ func (j *Component) UnmarshalJSON(value []byte) error { if _, ok := raw["runtime_id"]; raw != nil && !ok { return fmt.Errorf("field runtime_id in Component: required") } - if _, ok := raw["runtime_version"]; raw != nil && !ok { - return fmt.Errorf("field runtime_version in Component: required") - } if _, ok := raw["status"]; raw != nil && !ok { return fmt.Errorf("field status in Component: required") } @@ -473,6 +456,9 @@ type Runtime struct { // The author of the runtime Author RuntimeAuthor `json:"author" yaml:"author" mapstructure:"author"` + // The default version of the runtime + DefaultVersion string `json:"default_version" yaml:"default_version" mapstructure:"default_version"` + // A description of the runtime Description *string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"` @@ -487,9 +473,6 @@ type Runtime struct { // The metrics configuration of the runtime, if any Metrics *RuntimeMetrics `json:"metrics,omitempty" yaml:"metrics,omitempty" mapstructure:"metrics,omitempty"` - - // The version of this runtime definition - Version string `json:"version" yaml:"version" mapstructure:"version"` } // The author of the runtime @@ -525,9 +508,6 @@ func (j *RuntimeAuthor) UnmarshalJSON(value []byte) error { type RuntimeGetRequest struct { // The name of the runtime Name string `json:"name" yaml:"name" mapstructure:"name"` - - // The version of the runtime to query - Version string `json:"version" yaml:"version" mapstructure:"version"` } // UnmarshalJSON implements json.Unmarshaler. @@ -539,9 +519,6 @@ func (j *RuntimeGetRequest) UnmarshalJSON(value []byte) error { if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in RuntimeGetRequest: required") } - if _, ok := raw["version"]; raw != nil && !ok { - return fmt.Errorf("field version in RuntimeGetRequest: required") - } type Plain RuntimeGetRequest var plain Plain if err := json.Unmarshal(value, &plain); err != nil { @@ -577,68 +554,7 @@ func (j *RuntimeGetResponse) UnmarshalJSON(value []byte) error { return nil } -type RuntimeLatestVersionRequest struct { - // The runtime ID to find the latest version for - RuntimeId string `json:"runtime_id" yaml:"runtime_id" mapstructure:"runtime_id"` -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *RuntimeLatestVersionRequest) UnmarshalJSON(value []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(value, &raw); err != nil { - return err - } - if _, ok := raw["runtime_id"]; raw != nil && !ok { - return fmt.Errorf("field runtime_id in RuntimeLatestVersionRequest: required") - } - type Plain RuntimeLatestVersionRequest - var plain Plain - if err := json.Unmarshal(value, &plain); err != nil { - return err - } - *j = RuntimeLatestVersionRequest(plain) - return nil -} - -type RuntimeLatestVersionResponse struct { - // True if the runtime was found - Found bool `json:"found" yaml:"found" mapstructure:"found"` - - // The runtime ID that was queried - RuntimeId string `json:"runtime_id" yaml:"runtime_id" mapstructure:"runtime_id"` - - // The latest version found, empty if none found - Version string `json:"version" yaml:"version" mapstructure:"version"` -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *RuntimeLatestVersionResponse) UnmarshalJSON(value []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(value, &raw); err != nil { - return err - } - if _, ok := raw["found"]; raw != nil && !ok { - return fmt.Errorf("field found in RuntimeLatestVersionResponse: required") - } - if _, ok := raw["runtime_id"]; raw != nil && !ok { - return fmt.Errorf("field runtime_id in RuntimeLatestVersionResponse: required") - } - if _, ok := raw["version"]; raw != nil && !ok { - return fmt.Errorf("field version in RuntimeLatestVersionResponse: required") - } - type Plain RuntimeLatestVersionResponse - var plain Plain - if err := json.Unmarshal(value, &plain); err != nil { - return err - } - *j = RuntimeLatestVersionResponse(plain) - return nil -} - -type RuntimeListRequest struct { - // Optional filter to list versions for a specific runtime ID only - RuntimeId *string `json:"runtime_id,omitempty" yaml:"runtime_id,omitempty" mapstructure:"runtime_id,omitempty"` -} +type RuntimeListRequest map[string]interface{} type RuntimeListResponse struct { // Runtimes corresponds to the JSON schema field "runtimes". @@ -674,7 +590,10 @@ func (j *RuntimeMetrics) UnmarshalJSON(value []byte) error { type RuntimeSummary struct { // The author of the runtime - Author RuntimeAuthor `json:"author" yaml:"author" mapstructure:"author"` + Author string `json:"author" yaml:"author" mapstructure:"author"` + + // The default version of the runtime + DefaultVersion string `json:"default_version" yaml:"default_version" mapstructure:"default_version"` // A description of the runtime Description *string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"` @@ -684,9 +603,6 @@ type RuntimeSummary struct { // A human readable label for the runtime Label string `json:"label" yaml:"label" mapstructure:"label"` - - // The version of this runtime definition - Version string `json:"version" yaml:"version" mapstructure:"version"` } // UnmarshalJSON implements json.Unmarshaler. @@ -698,15 +614,15 @@ func (j *RuntimeSummary) UnmarshalJSON(value []byte) error { if _, ok := raw["author"]; raw != nil && !ok { return fmt.Errorf("field author in RuntimeSummary: required") } + if _, ok := raw["default_version"]; raw != nil && !ok { + return fmt.Errorf("field default_version in RuntimeSummary: required") + } if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in RuntimeSummary: required") } if _, ok := raw["label"]; raw != nil && !ok { return fmt.Errorf("field label in RuntimeSummary: required") } - if _, ok := raw["version"]; raw != nil && !ok { - return fmt.Errorf("field version in RuntimeSummary: required") - } type Plain RuntimeSummary var plain Plain if err := json.Unmarshal(value, &plain); err != nil { @@ -734,14 +650,14 @@ func (j *Runtime) UnmarshalJSON(value []byte) error { if _, ok := raw["label"]; raw != nil && !ok { return fmt.Errorf("field label in Runtime: required") } - if _, ok := raw["version"]; raw != nil && !ok { - return fmt.Errorf("field version in Runtime: required") - } type Plain Runtime var plain Plain if err := json.Unmarshal(value, &plain); err != nil { return err } + if v, ok := raw["default_version"]; !ok || v == nil { + plain.DefaultVersion = "latest" + } *j = Runtime(plain) return nil } diff --git a/model/schemas/library.schema.json b/model/schemas/library.schema.json index 9de2aec..e236a1e 100644 --- a/model/schemas/library.schema.json +++ b/model/schemas/library.schema.json @@ -34,10 +34,6 @@ "type": "string", "description": "The unique identifier of the runtime to which this component belongs" }, - "runtime_version": { - "type": "string", - "description": "The version of the runtime to query (optional, defaults to most recent runtime version)" - }, "kind": { "description": "The kind of the component", "$ref": "#/$defs/ComponentKind" @@ -97,13 +93,9 @@ "name": { "type": "string", "description": "The name of the runtime" - }, - "version": { - "type": "string", - "description": "The version of the runtime to query" } }, - "required": ["name", "version"] + "required": ["name"] }, "RuntimeGetResponse": { "$id": "io.synadia.connect.v1.library.control.runtime.get.response", @@ -274,10 +266,6 @@ "type": "string", "description": "The unique identifier of the runtime to which this component belongs" }, - "runtime_version": { - "type": "string", - "description": "The version of the runtime this component belongs to" - }, "name": { "type": "string", "description": "The name of the component. This field can only contain alphanumeric characters and underscores", @@ -297,10 +285,6 @@ "type": "string", "description": "A description of the component" }, - "icon": { - "type": "string", - "description": "The URL path to the icon. Can be a data: URL." - }, "fields": { "type": "array", "items": { @@ -310,7 +294,6 @@ }, "required": [ "runtime_id", - "runtime_version", "name", "label", "kind", @@ -326,10 +309,6 @@ "type": "string", "description": "The unique identifier of the runtime to which this component belongs" }, - "runtime_version": { - "type": "string", - "description": "The version of the runtime this component belongs to" - }, "name": { "type": "string", "description": "The name of the component. This field can only contain alphanumeric characters and underscores", @@ -348,15 +327,10 @@ "description": { "type": "string", "description": "A description of the component" - }, - "icon": { - "type": "string", - "description": "The URL path to the icon. Can be a data: URL." } }, "required": [ "runtime_id", - "runtime_version", "name", "label", "kind", @@ -372,10 +346,6 @@ "type": "string", "description": "The unique identifier of the runtime" }, - "runtime_version": { - "type": "string", - "description": "The version of the runtime to filter by (optional)" - }, "status": { "$ref": "#/$defs/ComponentStatus" }, @@ -403,16 +373,29 @@ }, "author": { "description": "The author of the runtime", - "$ref": "#/$defs/RuntimeAuthor" + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the author" + }, + "email": { + "type": "string", + "description": "The email address of the author" + }, + "url": { + "type": "string", + "description": "The url to a website related to the author" + } + }, + "required": [ + "name" + ] }, "image": { "type": "string", "description": "The location of the image to execute" }, - "version": { - "type": "string", - "description": "The version of this runtime definition" - }, "metrics": { "description": "The metrics configuration of the runtime, if any", "type": "object", @@ -435,8 +418,7 @@ "id", "label", "author", - "image", - "version" + "image" ] }, "RuntimeSummary": { @@ -458,11 +440,7 @@ }, "author": { "description": "The author of the runtime", - "$ref": "#/$defs/RuntimeAuthor" - }, - "version": { - "type": "string", - "description": "The version of this runtime definition" + "type": "string" } }, "required": [ @@ -470,29 +448,6 @@ "label", "author" ] - }, - "RuntimeAuthor": { - "$id": "io.synadia.connect.v1.library.model.runtime.author", - "title": "RuntimeAuthor", - "description": "The author of the runtime", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the author" - }, - "email": { - "type": "string", - "description": "The email address of the author" - }, - "url": { - "type": "string", - "description": "The url to a website related to the author" - } - }, - "required": [ - "name" - ] } } } diff --git a/runtime/runtime.go b/runtime/runtime.go index dfd9d14..7602bf5 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -9,7 +9,7 @@ import ( "strings" "github.com/nats-io/nats.go" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" "gopkg.in/yaml.v3" ) diff --git a/runtime/runtime_test.go b/runtime/runtime_test.go index 48edf26..374216e 100644 --- a/runtime/runtime_test.go +++ b/runtime/runtime_test.go @@ -6,8 +6,8 @@ import ( "log/slog" "strings" - "github.com/synadia-io/connect/v2/model" - "github.com/synadia-io/connect/v2/runtime" + "github.com/synadia-io/connect/model" + "github.com/synadia-io/connect/runtime" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/spec/builders/connector.go b/spec/builders/connector.go index dca5f3f..4fae325 100644 --- a/spec/builders/connector.go +++ b/spec/builders/connector.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/spec" +import "github.com/synadia-io/connect/spec" type ConnectorBuilder struct { s *spec.ConnectorSpec diff --git a/spec/builders/consumer.go b/spec/builders/consumer.go index 31da4e5..ad31c36 100644 --- a/spec/builders/consumer.go +++ b/spec/builders/consumer.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type ConsumerStepBuilder struct { diff --git a/spec/builders/consumer_core.go b/spec/builders/consumer_core.go index fb67774..3defea3 100644 --- a/spec/builders/consumer_core.go +++ b/spec/builders/consumer_core.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type ConsumerStepCoreBuilder struct { diff --git a/spec/builders/consumer_kv.go b/spec/builders/consumer_kv.go index 999a9c0..3a8c163 100644 --- a/spec/builders/consumer_kv.go +++ b/spec/builders/consumer_kv.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type ConsumerStepKvBuilder struct { diff --git a/spec/builders/consumer_stream.go b/spec/builders/consumer_stream.go index 5356971..7d12188 100644 --- a/spec/builders/consumer_stream.go +++ b/spec/builders/consumer_stream.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type ConsumerStepStreamBuilder struct { diff --git a/spec/builders/nats.go b/spec/builders/nats.go index db2a259..eda3984 100644 --- a/spec/builders/nats.go +++ b/spec/builders/nats.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) const DefaultNatsUrl = "nats://localhost:4222" diff --git a/spec/builders/producer.go b/spec/builders/producer.go index 85ac7eb..ba0e85a 100644 --- a/spec/builders/producer.go +++ b/spec/builders/producer.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type ProducerStepBuilder struct { diff --git a/spec/builders/producer_core.go b/spec/builders/producer_core.go index 82901ed..c45b0c9 100644 --- a/spec/builders/producer_core.go +++ b/spec/builders/producer_core.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type ProducerStepCoreBuilder struct { diff --git a/spec/builders/producer_kv.go b/spec/builders/producer_kv.go index c7efc66..11429ba 100644 --- a/spec/builders/producer_kv.go +++ b/spec/builders/producer_kv.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type ProducerStepKvBuilder struct { diff --git a/spec/builders/producer_stream.go b/spec/builders/producer_stream.go index 9039bc5..9f7a3af 100644 --- a/spec/builders/producer_stream.go +++ b/spec/builders/producer_stream.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type ProducerStepStreamBuilder struct { diff --git a/spec/builders/sink.go b/spec/builders/sink.go index 7cf46ba..00c3d76 100644 --- a/spec/builders/sink.go +++ b/spec/builders/sink.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type SinkStepBuilder struct { diff --git a/spec/builders/source.go b/spec/builders/source.go index 21d3e10..5a5a572 100644 --- a/spec/builders/source.go +++ b/spec/builders/source.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type SourceStepBuilder struct { diff --git a/spec/builders/steps.go b/spec/builders/steps.go index 0b9708a..885ddb2 100644 --- a/spec/builders/steps.go +++ b/spec/builders/steps.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type StepsBuilder struct { diff --git a/spec/builders/transformer.go b/spec/builders/transformer.go index 73ef986..cfae723 100644 --- a/spec/builders/transformer.go +++ b/spec/builders/transformer.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type TransformerStepBuilder struct { diff --git a/spec/builders/transformer_combine.go b/spec/builders/transformer_combine.go index 6b682e4..2f5349e 100644 --- a/spec/builders/transformer_combine.go +++ b/spec/builders/transformer_combine.go @@ -1,6 +1,6 @@ package builders -import "github.com/synadia-io/connect/v2/spec" +import "github.com/synadia-io/connect/spec" type CombineTransformerStepBuilder struct { res *spec.TransformerStepSpecCombine diff --git a/spec/builders/transformer_composite.go b/spec/builders/transformer_composite.go index d2e6493..e7e31ca 100644 --- a/spec/builders/transformer_composite.go +++ b/spec/builders/transformer_composite.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type CompositeTransformerStepBuilder struct { diff --git a/spec/builders/transformer_explode.go b/spec/builders/transformer_explode.go index 858e65f..7e80942 100644 --- a/spec/builders/transformer_explode.go +++ b/spec/builders/transformer_explode.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type ExplodeTransformerStepBuilder struct { diff --git a/spec/builders/transformer_mapping.go b/spec/builders/transformer_mapping.go index 7ad7ec9..e260c58 100644 --- a/spec/builders/transformer_mapping.go +++ b/spec/builders/transformer_mapping.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type MappingTransformerStepBuilder struct { diff --git a/spec/builders/transformer_service.go b/spec/builders/transformer_service.go index 8f329b1..4476572 100644 --- a/spec/builders/transformer_service.go +++ b/spec/builders/transformer_service.go @@ -1,7 +1,7 @@ package builders import ( - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" ) type ServiceTransformerStepBuilder struct { diff --git a/spec/common.go b/spec/common.go index 042a1b9..e202a5e 100644 --- a/spec/common.go +++ b/spec/common.go @@ -2,8 +2,10 @@ package spec -import "encoding/json" -import "fmt" +import ( + "encoding/json" + "fmt" +) type NatsConfigSpec struct { // Whether authentication is enabled diff --git a/spec/connector.go b/spec/connector.go index 336161e..00d8ae5 100644 --- a/spec/connector.go +++ b/spec/connector.go @@ -2,9 +2,11 @@ package spec -import "encoding/json" -import "fmt" -import "reflect" +import ( + "encoding/json" + "fmt" + "reflect" +) type ConnectorSpec struct { // A description of the connector @@ -14,9 +16,6 @@ type ConnectorSpec struct { // version, e.g. 'wombat:edge' RuntimeId string `json:"runtime_id" yaml:"runtime_id" mapstructure:"runtime_id"` - // The version of the runtime - RuntimeVersion *string `json:"runtime_version,omitempty" yaml:"runtime_version,omitempty" mapstructure:"runtime_version,omitempty"` - // Steps corresponds to the JSON schema field "steps". Steps StepsSpec `json:"steps" yaml:"steps" mapstructure:"steps"` } diff --git a/spec/schemas/connector-spec.schema.json b/spec/schemas/connector-spec.schema.json index b78b57e..546990f 100644 --- a/spec/schemas/connector-spec.schema.json +++ b/spec/schemas/connector-spec.schema.json @@ -12,10 +12,6 @@ "type": "string", "description": "The runtime to use for this connector. The runtime can be suffixed with the version, e.g. 'wombat:edge'" }, - "runtime_version": { - "type": "string", - "description": "The version of the runtime" - }, "steps": { "$ref": "connector-steps-model.schema.json" } diff --git a/standalone/converter.go b/standalone/converter.go index 8330aa3..7da622c 100644 --- a/standalone/converter.go +++ b/standalone/converter.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/synadia-io/connect/v2/model" + "github.com/synadia-io/connect/model" ) // ConfigConverter converts Synadia Connect steps to runtime-specific configuration diff --git a/validation/validator.go b/validation/validator.go index e026e4d..8cc0a1b 100644 --- a/validation/validator.go +++ b/validation/validator.go @@ -6,7 +6,7 @@ import ( "os" "path/filepath" - "github.com/synadia-io/connect/v2/spec" + "github.com/synadia-io/connect/spec" "gopkg.in/yaml.v3" )