mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-27 05:15:47 +00:00
generate json-schema dynamically in Go
This commit is contained in:
29
internal/config/route.go
Normal file
29
internal/config/route.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package config
|
||||
|
||||
import "github.com/google/jsonschema-go/jsonschema"
|
||||
|
||||
type RouteConfig struct {
|
||||
Input string `json:"input"`
|
||||
Processors []ProcessorConfig `json:"processors"`
|
||||
}
|
||||
|
||||
var RoutesConfigSchema = jsonschema.Schema{
|
||||
Schema: "https://json-schema.org/draft/2020-12/schema",
|
||||
ID: "https://showbridge.io/routes.schema.json",
|
||||
Title: "Routes",
|
||||
Description: "route configurations",
|
||||
Type: "array",
|
||||
Items: &jsonschema.Schema{
|
||||
Type: "object",
|
||||
Properties: map[string]*jsonschema.Schema{
|
||||
"input": {
|
||||
Type: "string",
|
||||
MinLength: jsonschema.Ptr(1),
|
||||
},
|
||||
"processors": {
|
||||
Ref: "https://showbridge.io/processors.schema.json",
|
||||
},
|
||||
},
|
||||
Required: []string{"input"},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user