mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-20 18:37:01 +00:00
feat(validator): use jsonschema Draft2020
This commit is contained in:
parent
e60892483e
commit
5f834b4f27
1 changed files with 6 additions and 5 deletions
|
|
@ -5,6 +5,11 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
jsonschema "github.com/santhosh-tekuri/jsonschema/v6"
|
jsonschema "github.com/santhosh-tekuri/jsonschema/v6"
|
||||||
"github.com/yannh/kubeconform/pkg/cache"
|
"github.com/yannh/kubeconform/pkg/cache"
|
||||||
"github.com/yannh/kubeconform/pkg/loader"
|
"github.com/yannh/kubeconform/pkg/loader"
|
||||||
|
|
@ -12,11 +17,7 @@ import (
|
||||||
"github.com/yannh/kubeconform/pkg/resource"
|
"github.com/yannh/kubeconform/pkg/resource"
|
||||||
"golang.org/x/text/language"
|
"golang.org/x/text/language"
|
||||||
"golang.org/x/text/message"
|
"golang.org/x/text/message"
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Different types of validation results
|
// Different types of validation results
|
||||||
|
|
@ -375,7 +376,7 @@ func downloadSchema(registries []registry.Registry, l jsonschema.SchemeURLLoader
|
||||||
c := jsonschema.NewCompiler()
|
c := jsonschema.NewCompiler()
|
||||||
c.RegisterFormat(&jsonschema.Format{"duration", validateDuration})
|
c.RegisterFormat(&jsonschema.Format{"duration", validateDuration})
|
||||||
c.UseLoader(l)
|
c.UseLoader(l)
|
||||||
c.DefaultDraft(jsonschema.Draft4)
|
c.DefaultDraft(jsonschema.Draft2020)
|
||||||
if err := c.AddResource(path, s); err != nil {
|
if err := c.AddResource(path, s); err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue