mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
move schema to an internal package
This commit is contained in:
27
internal/schema/schema.go
Normal file
27
internal/schema/schema.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"github.com/google/jsonschema-go/jsonschema"
|
||||
)
|
||||
|
||||
func GetResolvedConfigSchema() (*jsonschema.Resolved, error) {
|
||||
configSchema := ConfigSchema
|
||||
|
||||
return configSchema.Resolve(&jsonschema.ResolveOptions{
|
||||
Loader: func(uri *url.URL) (*jsonschema.Schema, error) {
|
||||
switch uri.String() {
|
||||
case "https://showbridge.io/modules.schema.json":
|
||||
return GetModulesSchema(), nil
|
||||
case "https://showbridge.io/processors.schema.json":
|
||||
return GetProcessorsSchema(), nil
|
||||
case "https://showbridge.io/routes.schema.json":
|
||||
return &RoutesConfigSchema, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown schema reference: %s", uri.String())
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user