From 757612fd0e064b9aa5f0a25999242e7f9ce05e6e Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Fri, 11 Sep 2026 09:21:46 -0500 Subject: [PATCH] sort processor and module schemas by ID --- schema/modules.go | 2 ++ schema/processors.go | 3 +++ schema/schema.go | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/schema/modules.go b/schema/modules.go index 2ffb420..895aa14 100644 --- a/schema/modules.go +++ b/schema/modules.go @@ -2,6 +2,7 @@ package schema import ( "encoding/json" + "slices" "github.com/google/jsonschema-go/jsonschema" "github.com/jwetzell/showbridge-go/internal/module" @@ -49,6 +50,7 @@ func GetModulesSchema() *jsonschema.Schema { } moduleDefinitionSchemas = append(moduleDefinitionSchemas, moduleSchema) } + slices.SortFunc(moduleDefinitionSchemas, schemaCmp) schema.Items = &jsonschema.Schema{ OneOf: moduleDefinitionSchemas, } diff --git a/schema/processors.go b/schema/processors.go index 7251a91..3201565 100644 --- a/schema/processors.go +++ b/schema/processors.go @@ -2,6 +2,7 @@ package schema import ( "encoding/json" + "slices" "github.com/google/jsonschema-go/jsonschema" "github.com/jwetzell/showbridge-go/internal/processor" @@ -49,6 +50,8 @@ func GetProcessorsSchema() *jsonschema.Schema { } processorDefinitionSchemas = append(processorDefinitionSchemas, processorSchema) } + + slices.SortFunc(processorDefinitionSchemas, schemaCmp) schema.Items = &jsonschema.Schema{ OneOf: processorDefinitionSchemas, } diff --git a/schema/schema.go b/schema/schema.go index 911f46a..44a58e3 100644 --- a/schema/schema.go +++ b/schema/schema.go @@ -1,6 +1,7 @@ package schema import ( + "cmp" "fmt" "net/url" @@ -24,3 +25,7 @@ func GetResolvedConfigSchema() (*jsonschema.Resolved, error) { ValidateDefaults: true, }) } + +func schemaCmp(a, b *jsonschema.Schema) int { + return cmp.Compare(a.ID, b.ID) +}