Skip to content

Commit 51065ea

Browse files
committed
Force Draft version of JsonSchema
1 parent 278385f commit 51065ea

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/validator/validator.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"errors"
77
"fmt"
88
"io"
9+
"strings"
910

1011
jsonschema "github.com/santhosh-tekuri/jsonschema/v5"
1112
_ "github.com/santhosh-tekuri/jsonschema/v5/httploader"
@@ -254,7 +255,12 @@ func downloadSchema(registries []registry.Registry, kind, version, k8sVersion st
254255
for _, reg := range registries {
255256
path, schemaBytes, err = reg.DownloadSchema(kind, version, k8sVersion)
256257
if err == nil {
257-
schema, err := jsonschema.CompileString(path, string(schemaBytes))
258+
c := jsonschema.NewCompiler()
259+
c.Draft = jsonschema.Draft4
260+
if err := c.AddResource(path, strings.NewReader(string(schemaBytes))); err != nil {
261+
continue
262+
}
263+
schema, err := c.Compile(path)
258264
// If we got a non-parseable response, we try the next registry
259265
if err != nil {
260266
continue

0 commit comments

Comments
 (0)