Avoid unnecessary type conversions

This commit is contained in:
Yann Hamon 2023-07-16 10:25:13 +02:00
parent ae67bb4709
commit b699dc5f94

View file

@ -2,11 +2,11 @@
package validator package validator
import ( import (
"bytes"
"context" "context"
"errors" "errors"
"fmt" "fmt"
"io" "io"
"strings"
jsonschema "github.com/santhosh-tekuri/jsonschema/v5" jsonschema "github.com/santhosh-tekuri/jsonschema/v5"
_ "github.com/santhosh-tekuri/jsonschema/v5/httploader" _ "github.com/santhosh-tekuri/jsonschema/v5/httploader"
@ -257,7 +257,7 @@ func downloadSchema(registries []registry.Registry, kind, version, k8sVersion st
if err == nil { if err == nil {
c := jsonschema.NewCompiler() c := jsonschema.NewCompiler()
c.Draft = jsonschema.Draft4 c.Draft = jsonschema.Draft4
if err := c.AddResource(path, strings.NewReader(string(schemaBytes))); err != nil { if err := c.AddResource(path, bytes.NewReader(schemaBytes)); err != nil {
continue continue
} }
schema, err := c.Compile(path) schema, err := c.Compile(path)