13
0
Fork 0
mirror of https://github.com/yannh/kubeconform.git synced 2026-07-03 18:09:30 +00:00

fix: update duration validation to use strfmt package

This commit is contained in:
nissy-dev 2026-06-04 21:40:10 +02:00 committed by Yann Hamon
parent ab97ec7693
commit 82ca67d2d0
37 changed files with 5322 additions and 11 deletions

View file

@ -2,12 +2,13 @@ package validator
import (
"bytes"
"github.com/santhosh-tekuri/jsonschema/v6"
"github.com/yannh/kubeconform/pkg/loader"
"io"
"reflect"
"testing"
"github.com/santhosh-tekuri/jsonschema/v6"
"github.com/yannh/kubeconform/pkg/loader"
"github.com/yannh/kubeconform/pkg/registry"
"github.com/yannh/kubeconform/pkg/resource"
@ -385,6 +386,33 @@ lastName: bar
kind: name
apiVersion: v1
interval: 5s
`),
[]byte(`{
"title": "Example Schema",
"type": "object",
"properties": {
"kind": {
"type": "string"
},
"interval": {
"type": "string",
"format": "duration"
}
},
"required": ["interval"]
}`),
nil,
false,
false,
Valid,
[]ValidationError{},
},
{
"valid resource duration - scala duration format",
[]byte(`
kind: name
apiVersion: v1
interval: 2w
`),
[]byte(`{
"title": "Example Schema",