From f57f9d8ce5e698e689f461087f444eb264a1ea55 Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Mon, 30 Mar 2026 20:58:39 -0500 Subject: [PATCH] fix additionProperties in JSONSchema and add IDs to everything --- internal/module/db-sqlite.go | 3 ++- internal/module/http-server.go | 2 +- internal/module/midi-input.go | 2 +- internal/module/midi-output.go | 2 +- internal/module/mqtt-client.go | 2 +- internal/module/nats-client.go | 2 +- internal/module/nats-server.go | 5 ++--- internal/module/psn-client.go | 1 - internal/module/redis-client.go | 2 +- internal/module/serial-client.go | 2 +- internal/module/sip-call-server.go | 2 +- internal/module/sip-dtmf-server.go | 2 +- internal/module/tcp-client.go | 2 +- internal/module/tcp-server.go | 2 +- internal/module/time-interval.go | 2 +- internal/module/time-timer.go | 2 +- internal/module/udp-client.go | 2 +- internal/module/udp-multicast.go | 2 +- internal/module/udp-server.go | 2 +- internal/processor/filter-expr.go | 2 +- internal/processor/filter-regex.go | 2 +- internal/processor/float-parse.go | 2 +- internal/processor/float-random.go | 2 +- internal/processor/free-d-create.go | 2 +- internal/processor/http-request-do.go | 2 +- internal/processor/http-response-create.go | 2 +- internal/processor/int-parse.go | 2 +- internal/processor/int-random.go | 2 +- internal/processor/int-scale.go | 2 +- internal/processor/kv-get.go | 2 +- internal/processor/kv-set.go | 2 +- internal/processor/midi-control_change-create.go | 2 +- internal/processor/midi-note_off-create.go | 2 +- internal/processor/midi-note_on-create.go | 2 +- internal/processor/midi-program_change-create.go | 2 +- internal/processor/mqtt-message-create.go | 2 +- internal/processor/nats-message-create.go | 2 +- internal/processor/osc-message-create.go | 2 +- internal/processor/router-input.go | 2 +- internal/processor/router-output.go | 2 +- internal/processor/script-expr.go | 2 +- internal/processor/script-js.go | 2 +- internal/processor/script-wasm.go | 2 +- internal/processor/sip-response-audio-create.go | 2 +- internal/processor/sip-response-dtmf-create.go | 2 +- internal/processor/string-create.go | 2 +- internal/processor/string-split.go | 2 +- internal/processor/struct-field-get.go | 3 ++- internal/processor/struct-method-get.go | 3 ++- internal/processor/time-sleep.go | 3 ++- internal/schema/api.go | 6 ++++-- internal/schema/config.go | 1 + internal/schema/modules.go | 6 +++++- internal/schema/processors.go | 6 +++++- internal/schema/routes.go | 10 ++++++++-- 55 files changed, 77 insertions(+), 58 deletions(-) diff --git a/internal/module/db-sqlite.go b/internal/module/db-sqlite.go index 1be8beb..c0941e0 100644 --- a/internal/module/db-sqlite.go +++ b/internal/module/db-sqlite.go @@ -35,7 +35,8 @@ func init() { MinLength: jsonschema.Ptr(1), }, }, - Required: []string{"dsn"}, + Required: []string{"dsn"}, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ModuleConfig) (common.Module, error) { params := config.Params diff --git a/internal/module/http-server.go b/internal/module/http-server.go index ddb3d36..4a6068e 100644 --- a/internal/module/http-server.go +++ b/internal/module/http-server.go @@ -69,7 +69,7 @@ func init() { }, }, Required: []string{"port"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ModuleConfig) (common.Module, error) { params := config.Params diff --git a/internal/module/midi-input.go b/internal/module/midi-input.go index c875998..40eb5eb 100644 --- a/internal/module/midi-input.go +++ b/internal/module/midi-input.go @@ -38,7 +38,7 @@ func init() { }, }, Required: []string{"port"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ModuleConfig) (common.Module, error) { params := config.Params diff --git a/internal/module/midi-output.go b/internal/module/midi-output.go index 58973e0..d4660be 100644 --- a/internal/module/midi-output.go +++ b/internal/module/midi-output.go @@ -38,7 +38,7 @@ func init() { }, }, Required: []string{"port"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ModuleConfig) (common.Module, error) { params := config.Params diff --git a/internal/module/mqtt-client.go b/internal/module/mqtt-client.go index 31b8c5e..c73d675 100644 --- a/internal/module/mqtt-client.go +++ b/internal/module/mqtt-client.go @@ -45,7 +45,7 @@ func init() { }, }, Required: []string{"broker", "topic", "clientId"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ModuleConfig) (common.Module, error) { params := config.Params diff --git a/internal/module/nats-client.go b/internal/module/nats-client.go index 20e869b..e32f6e7 100644 --- a/internal/module/nats-client.go +++ b/internal/module/nats-client.go @@ -40,7 +40,7 @@ func init() { }, }, Required: []string{"url", "subject"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ModuleConfig) (common.Module, error) { params := config.Params diff --git a/internal/module/nats-server.go b/internal/module/nats-server.go index d1b714a..7b2ebd0 100644 --- a/internal/module/nats-server.go +++ b/internal/module/nats-server.go @@ -46,9 +46,8 @@ func init() { Default: json.RawMessage(`4222`), }, }, - Required: []string{}, - - AdditionalProperties: nil, + Required: []string{}, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(moduleConfig config.ModuleConfig) (common.Module, error) { params := moduleConfig.Params diff --git a/internal/module/psn-client.go b/internal/module/psn-client.go index ebcec91..bc06cb0 100644 --- a/internal/module/psn-client.go +++ b/internal/module/psn-client.go @@ -27,7 +27,6 @@ func init() { Type: "psn.client", Title: "PosiStageNet Client", New: func(config config.ModuleConfig) (common.Module, error) { - return &PSNClient{config: config, decoder: psn.NewDecoder(), logger: CreateLogger(config)}, nil }, }) diff --git a/internal/module/redis-client.go b/internal/module/redis-client.go index 2fafc98..7664d24 100644 --- a/internal/module/redis-client.go +++ b/internal/module/redis-client.go @@ -40,7 +40,7 @@ func init() { }, }, Required: []string{"host", "port"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ModuleConfig) (common.Module, error) { params := config.Params diff --git a/internal/module/serial-client.go b/internal/module/serial-client.go index 9802fe0..884fc81 100644 --- a/internal/module/serial-client.go +++ b/internal/module/serial-client.go @@ -45,7 +45,7 @@ func init() { }, }, Required: []string{"port", "baudRate"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ModuleConfig) (common.Module, error) { params := config.Params diff --git a/internal/module/sip-call-server.go b/internal/module/sip-call-server.go index 5c93aaf..c2bbab4 100644 --- a/internal/module/sip-call-server.go +++ b/internal/module/sip-call-server.go @@ -77,7 +77,7 @@ func init() { }, }, Required: []string{}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(moduleConfig config.ModuleConfig) (common.Module, error) { params := moduleConfig.Params diff --git a/internal/module/sip-dtmf-server.go b/internal/module/sip-dtmf-server.go index e562d3f..e8aaacd 100644 --- a/internal/module/sip-dtmf-server.go +++ b/internal/module/sip-dtmf-server.go @@ -83,7 +83,7 @@ func init() { }, }, Required: []string{"separator"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(moduleConfig config.ModuleConfig) (common.Module, error) { params := moduleConfig.Params diff --git a/internal/module/tcp-client.go b/internal/module/tcp-client.go index 4e759fd..da1c621 100644 --- a/internal/module/tcp-client.go +++ b/internal/module/tcp-client.go @@ -49,7 +49,7 @@ func init() { }, }, Required: []string{"host", "port", "framing"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ModuleConfig) (common.Module, error) { params := config.Params diff --git a/internal/module/tcp-server.go b/internal/module/tcp-server.go index a3e40a7..828f057 100644 --- a/internal/module/tcp-server.go +++ b/internal/module/tcp-server.go @@ -57,7 +57,7 @@ func init() { }, }, Required: []string{"port", "framing"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(moduleConfig config.ModuleConfig) (common.Module, error) { params := moduleConfig.Params diff --git a/internal/module/time-interval.go b/internal/module/time-interval.go index d531e52..3a8ae30 100644 --- a/internal/module/time-interval.go +++ b/internal/module/time-interval.go @@ -36,7 +36,7 @@ func init() { }, }, Required: []string{"duration"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ModuleConfig) (common.Module, error) { params := config.Params diff --git a/internal/module/time-timer.go b/internal/module/time-timer.go index f765013..22e4958 100644 --- a/internal/module/time-timer.go +++ b/internal/module/time-timer.go @@ -36,7 +36,7 @@ func init() { }, }, Required: []string{"duration"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ModuleConfig) (common.Module, error) { params := config.Params diff --git a/internal/module/udp-client.go b/internal/module/udp-client.go index 29e4bd9..ee9a0c2 100644 --- a/internal/module/udp-client.go +++ b/internal/module/udp-client.go @@ -42,7 +42,7 @@ func init() { }, }, Required: []string{"host", "port"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ModuleConfig) (common.Module, error) { params := config.Params diff --git a/internal/module/udp-multicast.go b/internal/module/udp-multicast.go index 0353ce0..f87a389 100644 --- a/internal/module/udp-multicast.go +++ b/internal/module/udp-multicast.go @@ -42,7 +42,7 @@ func init() { }, }, Required: []string{"ip", "port"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(moduleConfig config.ModuleConfig) (common.Module, error) { params := moduleConfig.Params diff --git a/internal/module/udp-server.go b/internal/module/udp-server.go index 3815784..36301fe 100644 --- a/internal/module/udp-server.go +++ b/internal/module/udp-server.go @@ -51,7 +51,7 @@ func init() { }, }, Required: []string{"port"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(moduleConfig config.ModuleConfig) (common.Module, error) { params := moduleConfig.Params diff --git a/internal/processor/filter-expr.go b/internal/processor/filter-expr.go index 7b90a37..d88169d 100644 --- a/internal/processor/filter-expr.go +++ b/internal/processor/filter-expr.go @@ -59,7 +59,7 @@ func init() { }, }, Required: []string{"expression"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/filter-regex.go b/internal/processor/filter-regex.go index e281242..c138c69 100644 --- a/internal/processor/filter-regex.go +++ b/internal/processor/filter-regex.go @@ -51,7 +51,7 @@ func init() { }, }, Required: []string{"pattern"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/float-parse.go b/internal/processor/float-parse.go index dd3f428..6166c9c 100644 --- a/internal/processor/float-parse.go +++ b/internal/processor/float-parse.go @@ -53,7 +53,7 @@ func init() { Default: json.RawMessage("64"), }, }, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(moduleConfig config.ProcessorConfig) (Processor, error) { params := moduleConfig.Params diff --git a/internal/processor/float-random.go b/internal/processor/float-random.go index ec06d6b..5bfe283 100644 --- a/internal/processor/float-random.go +++ b/internal/processor/float-random.go @@ -61,7 +61,7 @@ func init() { }, }, Required: []string{"min", "max"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(processorConfig config.ProcessorConfig) (Processor, error) { params := processorConfig.Params diff --git a/internal/processor/free-d-create.go b/internal/processor/free-d-create.go index 90669ff..b29233b 100644 --- a/internal/processor/free-d-create.go +++ b/internal/processor/free-d-create.go @@ -259,7 +259,7 @@ func init() { "zoom", "focus", }, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { diff --git a/internal/processor/http-request-do.go b/internal/processor/http-request-do.go index 1b89d98..67a6f77 100644 --- a/internal/processor/http-request-do.go +++ b/internal/processor/http-request-do.go @@ -87,7 +87,7 @@ func init() { }, }, Required: []string{"method", "url"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/http-response-create.go b/internal/processor/http-response-create.go index 2a720f8..e965291 100644 --- a/internal/processor/http-response-create.go +++ b/internal/processor/http-response-create.go @@ -60,7 +60,7 @@ func init() { }, }, Required: []string{"status", "body"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/int-parse.go b/internal/processor/int-parse.go index d91a4af..b6c578e 100644 --- a/internal/processor/int-parse.go +++ b/internal/processor/int-parse.go @@ -60,7 +60,7 @@ func init() { Default: json.RawMessage("64"), }, }, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(moduleConfig config.ProcessorConfig) (Processor, error) { params := moduleConfig.Params diff --git a/internal/processor/int-random.go b/internal/processor/int-random.go index 55825f6..0f0ace3 100644 --- a/internal/processor/int-random.go +++ b/internal/processor/int-random.go @@ -44,7 +44,7 @@ func init() { }, }, Required: []string{"min", "max"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/int-scale.go b/internal/processor/int-scale.go index 85d3b39..ead2932 100644 --- a/internal/processor/int-scale.go +++ b/internal/processor/int-scale.go @@ -60,7 +60,7 @@ func init() { }, }, Required: []string{"inMin", "inMax", "outMin", "outMax"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/kv-get.go b/internal/processor/kv-get.go index fa48576..fd6296f 100644 --- a/internal/processor/kv-get.go +++ b/internal/processor/kv-get.go @@ -67,7 +67,7 @@ func init() { }, }, Required: []string{"module", "key"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { diff --git a/internal/processor/kv-set.go b/internal/processor/kv-set.go index 52e6faf..17c9130 100644 --- a/internal/processor/kv-set.go +++ b/internal/processor/kv-set.go @@ -82,7 +82,7 @@ func init() { }, }, Required: []string{"module", "key", "value"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { diff --git a/internal/processor/midi-control_change-create.go b/internal/processor/midi-control_change-create.go index 90b4c28..1e9c76a 100644 --- a/internal/processor/midi-control_change-create.go +++ b/internal/processor/midi-control_change-create.go @@ -85,7 +85,7 @@ func init() { }, }, Required: []string{"channel", "control", "value"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { diff --git a/internal/processor/midi-note_off-create.go b/internal/processor/midi-note_off-create.go index c579e97..99369dd 100644 --- a/internal/processor/midi-note_off-create.go +++ b/internal/processor/midi-note_off-create.go @@ -84,7 +84,7 @@ func init() { }, }, Required: []string{"channel", "note", "velocity"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/midi-note_on-create.go b/internal/processor/midi-note_on-create.go index 6b7f810..fad5ef5 100644 --- a/internal/processor/midi-note_on-create.go +++ b/internal/processor/midi-note_on-create.go @@ -84,7 +84,7 @@ func init() { }, }, Required: []string{"channel", "note", "velocity"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/midi-program_change-create.go b/internal/processor/midi-program_change-create.go index 6979821..182941a 100644 --- a/internal/processor/midi-program_change-create.go +++ b/internal/processor/midi-program_change-create.go @@ -70,7 +70,7 @@ func init() { }, }, Required: []string{"type", "channel", "program"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/mqtt-message-create.go b/internal/processor/mqtt-message-create.go index b0bf7cf..0c43c5c 100644 --- a/internal/processor/mqtt-message-create.go +++ b/internal/processor/mqtt-message-create.go @@ -104,7 +104,7 @@ func init() { }, }, Required: []string{"topic", "qos", "retained", "payload"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(processorConfig config.ProcessorConfig) (Processor, error) { params := processorConfig.Params diff --git a/internal/processor/nats-message-create.go b/internal/processor/nats-message-create.go index c7210ae..6531fb8 100644 --- a/internal/processor/nats-message-create.go +++ b/internal/processor/nats-message-create.go @@ -75,7 +75,7 @@ func init() { }, }, Required: []string{"subject", "payload"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/osc-message-create.go b/internal/processor/osc-message-create.go index 719fbe4..b199a67 100644 --- a/internal/processor/osc-message-create.go +++ b/internal/processor/osc-message-create.go @@ -109,7 +109,7 @@ func init() { }, }, Required: []string{"address"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(processorConfig config.ProcessorConfig) (Processor, error) { params := processorConfig.Params diff --git a/internal/processor/router-input.go b/internal/processor/router-input.go index 280a77c..9e144ce 100644 --- a/internal/processor/router-input.go +++ b/internal/processor/router-input.go @@ -57,7 +57,7 @@ func init() { }, }, Required: []string{"source"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { diff --git a/internal/processor/router-output.go b/internal/processor/router-output.go index c760b23..1100223 100644 --- a/internal/processor/router-output.go +++ b/internal/processor/router-output.go @@ -53,7 +53,7 @@ func init() { }, }, Required: []string{"module"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { diff --git a/internal/processor/script-expr.go b/internal/processor/script-expr.go index 2497913..00d03f7 100644 --- a/internal/processor/script-expr.go +++ b/internal/processor/script-expr.go @@ -48,7 +48,7 @@ func init() { }, }, Required: []string{"expression"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/script-js.go b/internal/processor/script-js.go index bbd35f1..2733bc0 100644 --- a/internal/processor/script-js.go +++ b/internal/processor/script-js.go @@ -105,7 +105,7 @@ func init() { }, }, Required: []string{"program"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/script-wasm.go b/internal/processor/script-wasm.go index daaa76f..3767d56 100644 --- a/internal/processor/script-wasm.go +++ b/internal/processor/script-wasm.go @@ -73,7 +73,7 @@ func init() { }, }, Required: []string{"path"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(processorConfig config.ProcessorConfig) (Processor, error) { params := processorConfig.Params diff --git a/internal/processor/sip-response-audio-create.go b/internal/processor/sip-response-audio-create.go index 91c1dd6..e2265ea 100644 --- a/internal/processor/sip-response-audio-create.go +++ b/internal/processor/sip-response-audio-create.go @@ -70,7 +70,7 @@ func init() { }, }, Required: []string{"preWait", "postWait", "audioFile"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/sip-response-dtmf-create.go b/internal/processor/sip-response-dtmf-create.go index a836bf3..95f1f34 100644 --- a/internal/processor/sip-response-dtmf-create.go +++ b/internal/processor/sip-response-dtmf-create.go @@ -78,7 +78,7 @@ func init() { }, }, Required: []string{"preWait", "postWait", "digits"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/string-create.go b/internal/processor/string-create.go index bda5b5f..ed05f63 100644 --- a/internal/processor/string-create.go +++ b/internal/processor/string-create.go @@ -49,7 +49,7 @@ func init() { }, }, Required: []string{"template"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/string-split.go b/internal/processor/string-split.go index 5da69a2..dd3a180 100644 --- a/internal/processor/string-split.go +++ b/internal/processor/string-split.go @@ -47,7 +47,7 @@ func init() { }, }, Required: []string{"separator"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/struct-field-get.go b/internal/processor/struct-field-get.go index 5052338..86ce00c 100644 --- a/internal/processor/struct-field-get.go +++ b/internal/processor/struct-field-get.go @@ -55,7 +55,8 @@ func init() { Type: "string", }, }, - Required: []string{"name"}, + Required: []string{"name"}, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/struct-method-get.go b/internal/processor/struct-method-get.go index 374d042..3f65161 100644 --- a/internal/processor/struct-method-get.go +++ b/internal/processor/struct-method-get.go @@ -74,7 +74,8 @@ func init() { Type: "string", }, }, - Required: []string{"name"}, + Required: []string{"name"}, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/processor/time-sleep.go b/internal/processor/time-sleep.go index 4e25377..6458348 100644 --- a/internal/processor/time-sleep.go +++ b/internal/processor/time-sleep.go @@ -37,7 +37,8 @@ func init() { Description: "Duration to sleep in milliseconds", }, }, - Required: []string{"duration"}, + Required: []string{"duration"}, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, New: func(config config.ProcessorConfig) (Processor, error) { params := config.Params diff --git a/internal/schema/api.go b/internal/schema/api.go index 0d37ce2..5076678 100644 --- a/internal/schema/api.go +++ b/internal/schema/api.go @@ -7,6 +7,7 @@ import ( ) var ApiConfigSchema = jsonschema.Schema{ + ID: "https://showbridge.io/api.schema.json", Type: "object", Properties: map[string]*jsonschema.Schema{ "enabled": { @@ -22,6 +23,7 @@ var ApiConfigSchema = jsonschema.Schema{ Default: json.RawMessage(`8080`), }, }, - Required: []string{"port"}, - Default: json.RawMessage(`{"enabled": false, "port": 8080}`), + Required: []string{"port"}, + Default: json.RawMessage(`{"enabled": false, "port": 8080}`), + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, } diff --git a/internal/schema/config.go b/internal/schema/config.go index 90a8640..1cb7781 100644 --- a/internal/schema/config.go +++ b/internal/schema/config.go @@ -19,6 +19,7 @@ var ConfigSchema = jsonschema.Schema{ Ref: "https://showbridge.io/routes.schema.json", }, }, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, } func ApplyDefaults(cfg *map[string]any) error { diff --git a/internal/schema/modules.go b/internal/schema/modules.go index 1934108..71522fc 100644 --- a/internal/schema/modules.go +++ b/internal/schema/modules.go @@ -1,6 +1,8 @@ package schema import ( + "encoding/json" + "github.com/google/jsonschema-go/jsonschema" "github.com/jwetzell/showbridge-go/internal/module" ) @@ -13,11 +15,13 @@ func GetModulesSchema() *jsonschema.Schema { Title: "Modules", Description: "module configurations", Type: "array", + Default: json.RawMessage(`[]`), } moduleDefinitionSchemas := []*jsonschema.Schema{} for _, mod := range module.ModuleRegistry { moduleSchema := &jsonschema.Schema{ + ID: mod.Type, Type: "object", Properties: map[string]*jsonschema.Schema{ "id": { @@ -29,7 +33,7 @@ func GetModulesSchema() *jsonschema.Schema { }, }, Required: []string{"id", "type"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, } if mod.Title != "" { moduleSchema.Title = mod.Title diff --git a/internal/schema/processors.go b/internal/schema/processors.go index a9ca307..35920a2 100644 --- a/internal/schema/processors.go +++ b/internal/schema/processors.go @@ -1,6 +1,8 @@ package schema import ( + "encoding/json" + "github.com/google/jsonschema-go/jsonschema" "github.com/jwetzell/showbridge-go/internal/processor" ) @@ -13,11 +15,13 @@ func GetProcessorsSchema() *jsonschema.Schema { Title: "Processors", Description: "processor configurations", Type: "array", + Default: json.RawMessage(`[]`), } processorDefinitionSchemas := []*jsonschema.Schema{} for _, proc := range processor.ProcessorRegistry { processorSchema := &jsonschema.Schema{ + ID: proc.Type, Type: "object", Properties: map[string]*jsonschema.Schema{ "type": { @@ -25,7 +29,7 @@ func GetProcessorsSchema() *jsonschema.Schema { }, }, Required: []string{"type"}, - AdditionalProperties: nil, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, } if proc.Title != "" { processorSchema.Title = proc.Title diff --git a/internal/schema/routes.go b/internal/schema/routes.go index 65ba905..048d54c 100644 --- a/internal/schema/routes.go +++ b/internal/schema/routes.go @@ -1,6 +1,10 @@ package schema -import "github.com/google/jsonschema-go/jsonschema" +import ( + "encoding/json" + + "github.com/google/jsonschema-go/jsonschema" +) var RoutesConfigSchema = jsonschema.Schema{ Schema: "https://json-schema.org/draft/2020-12/schema", @@ -19,6 +23,8 @@ var RoutesConfigSchema = jsonschema.Schema{ Ref: "https://showbridge.io/processors.schema.json", }, }, - Required: []string{"input"}, + Required: []string{"input"}, + AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}}, }, + Default: json.RawMessage(`[]`), }