mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-21 19:07:00 +00:00
Force Draft version of JsonSchema
This commit is contained in:
parent
278385f4c9
commit
51065ea828
1 changed files with 7 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"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"
|
||||||
|
|
@ -254,7 +255,12 @@ func downloadSchema(registries []registry.Registry, kind, version, k8sVersion st
|
||||||
for _, reg := range registries {
|
for _, reg := range registries {
|
||||||
path, schemaBytes, err = reg.DownloadSchema(kind, version, k8sVersion)
|
path, schemaBytes, err = reg.DownloadSchema(kind, version, k8sVersion)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
schema, err := jsonschema.CompileString(path, string(schemaBytes))
|
c := jsonschema.NewCompiler()
|
||||||
|
c.Draft = jsonschema.Draft4
|
||||||
|
if err := c.AddResource(path, strings.NewReader(string(schemaBytes))); err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
schema, err := c.Compile(path)
|
||||||
// If we got a non-parseable response, we try the next registry
|
// If we got a non-parseable response, we try the next registry
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue