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:
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/google/jsonschema-go/jsonschema"
|
||||
"github.com/jwetzell/showbridge-go/internal/common"
|
||||
"github.com/jwetzell/showbridge-go/internal/config"
|
||||
)
|
||||
@@ -44,7 +45,18 @@ func (sf *StructFieldGet) Type() string {
|
||||
|
||||
func init() {
|
||||
RegisterProcessor(ProcessorRegistration{
|
||||
Type: "struct.field.get",
|
||||
Type: "struct.field.get",
|
||||
Title: "Get Struct Field",
|
||||
ParamsSchema: &jsonschema.Schema{
|
||||
Type: "object",
|
||||
Properties: map[string]*jsonschema.Schema{
|
||||
"name": {
|
||||
Title: "Field Name",
|
||||
Type: "string",
|
||||
},
|
||||
},
|
||||
Required: []string{"name"},
|
||||
},
|
||||
New: func(config config.ProcessorConfig) (Processor, error) {
|
||||
params := config.Params
|
||||
nameString, err := params.GetString("name")
|
||||
|
||||
Reference in New Issue
Block a user