mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
generate json-schema dynamically in Go
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"log/slog"
|
||||
"time"
|
||||
|
||||
"github.com/google/jsonschema-go/jsonschema"
|
||||
"github.com/jwetzell/showbridge-go/internal/common"
|
||||
"github.com/jwetzell/showbridge-go/internal/config"
|
||||
)
|
||||
@@ -23,7 +24,20 @@ type TimeInterval struct {
|
||||
|
||||
func init() {
|
||||
RegisterModule(ModuleRegistration{
|
||||
Type: "time.interval",
|
||||
Type: "time.interval",
|
||||
Title: "Interval",
|
||||
ParamsSchema: &jsonschema.Schema{
|
||||
Type: "object",
|
||||
Properties: map[string]*jsonschema.Schema{
|
||||
"duration": {
|
||||
Title: "Duration",
|
||||
Type: "integer",
|
||||
Description: "Interval duration in milliseconds",
|
||||
},
|
||||
},
|
||||
Required: []string{"duration"},
|
||||
AdditionalProperties: nil,
|
||||
},
|
||||
New: func(config config.ModuleConfig) (common.Module, error) {
|
||||
params := config.Params
|
||||
|
||||
|
||||
Reference in New Issue
Block a user