Compare commits

...

1 Commits

Author SHA1 Message Date
Joel Wetzell 92c661354c add id field to route and processor 2026-08-11 20:39:54 -05:00
6 changed files with 25 additions and 6 deletions
+7 -3
View File
@@ -13,11 +13,15 @@ modules:
port: 8000 port: 8000
routes: routes:
- input: http - input: http
id: http-to-osc
processors: processors:
- type: osc.message.create - id: create-osc
type: osc.message.create
params: params:
address: "{{.Payload.URL.Path}}" address: "{{.Payload.URL.Path}}"
- type: osc.message.encode - id: encode-osc
- type: module.output type: osc.message.encode
- id: output-osc
type: module.output
params: params:
module: udp module: udp
+1
View File
@@ -1,6 +1,7 @@
package config package config
type ProcessorConfig struct { type ProcessorConfig struct {
Id string `json:"id"`
Type string `json:"type"` Type string `json:"type"`
Params Params `json:"params,omitempty"` Params Params `json:"params,omitempty"`
} }
+1
View File
@@ -1,6 +1,7 @@
package config package config
type RouteConfig struct { type RouteConfig struct {
Id string `json:"id"`
Input string `json:"input"` Input string `json:"input"`
Processors []ProcessorConfig `json:"processors"` Processors []ProcessorConfig `json:"processors"`
} }
+6 -1
View File
@@ -10,6 +10,7 @@ import (
) )
type Route struct { type Route struct {
id string
input string input string
processors []processor.Processor processors []processor.Processor
} }
@@ -32,7 +33,11 @@ func NewRoute(config config.RouteConfig) (*Route, error) {
} }
} }
return &Route{input: config.Input, processors: processors}, nil return &Route{id: config.Id, input: config.Input, processors: processors}, nil
}
func (r *Route) Id() string {
return r.id
} }
func (r *Route) Input() string { func (r *Route) Input() string {
+5 -1
View File
@@ -24,11 +24,15 @@ func GetProcessorsSchema() *jsonschema.Schema {
ID: proc.Type, ID: proc.Type,
Type: "object", Type: "object",
Properties: map[string]*jsonschema.Schema{ Properties: map[string]*jsonschema.Schema{
"id": {
Type: "string",
MinLength: new(1),
},
"type": { "type": {
Const: jsonschema.Ptr[any](proc.Type), Const: jsonschema.Ptr[any](proc.Type),
}, },
}, },
Required: []string{"type"}, Required: []string{"id", "type"},
AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}},
} }
if proc.Title != "" { if proc.Title != "" {
+5 -1
View File
@@ -15,6 +15,10 @@ var RoutesConfigSchema = jsonschema.Schema{
Items: &jsonschema.Schema{ Items: &jsonschema.Schema{
Type: "object", Type: "object",
Properties: map[string]*jsonschema.Schema{ Properties: map[string]*jsonschema.Schema{
"id": {
Type: "string",
MinLength: new(1),
},
"input": { "input": {
Type: "string", Type: "string",
MinLength: new(1), MinLength: new(1),
@@ -23,7 +27,7 @@ var RoutesConfigSchema = jsonschema.Schema{
Ref: "https://showbridge.io/processors.schema.json", Ref: "https://showbridge.io/processors.schema.json",
}, },
}, },
Required: []string{"input"}, Required: []string{"id", "input"},
AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}},
}, },
Default: json.RawMessage(`[]`), Default: json.RawMessage(`[]`),