Home

ffcue @main - refs - log -
-
https://git.jolheiser.com/ffcue.git
tree log patch
fix duration and add final validation Signed-off-by: jolheiser <git@jolheiser.com>
Signature
-----BEGIN SSH SIGNATURE----- U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5 AAAAQFK8jFSeYVMClxe/EzqkPFMV/3j3FtTQjcX/J7ddQTiMgrgI/U4BGdo87S4iL8oCh8 eYdYqZHMYMAb0SwF2RBAQ= -----END SSH SIGNATURE-----
jolheiser <git@jolheiser.com>
1 week ago
4 changed files, 6 additions(+), 6 deletions(-)
schema.gotestdata/array_constraints.cuetestdata/bad.cuetestdata/constraints.cue
M schema.goschema.go
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
diff --git a/schema.go b/schema.go
index 460620b99085730ea5914e6b274f2aebce964890..4a815acfe2a2c0d63318635e253afbf9cb5bf9ec 100644
--- a/schema.go
+++ b/schema.go
@@ -28,7 +28,7 @@ 	}
 
 	unified := constraints.Unify(config)
 	if unified.Err() != nil {
-		err := unified.Validate(cue.Concrete(true))
+		err := unified.Validate(cue.Concrete(true), cue.Final())
 		var errs []string
 		for _, e := range errors.Errors(err) {
 			errs = append(errs, e.Error())
M testdata/array_constraints.cuetestdata/array_constraints.cue
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
diff --git a/testdata/array_constraints.cue b/testdata/array_constraints.cue
index 8ffac2cdfa35d4a3e9f1e2739a102808077a6841..cbddedf8ce9845994345a2cafcf5e27de5a0296f 100644
--- a/testdata/array_constraints.cue
+++ b/testdata/array_constraints.cue
@@ -1,7 +1,7 @@
-#Duration: string & =~"^([0-9]+(ns|us|µs|ms|s|m|h))+$"
+import "time"
 
 s: [string, string]
 i: [int, int, int]
 b: [bool, bool]
-d: [#Duration, #Duration]
+d: [time.Duration, time.Duration]
 x: [string, string, string]
M testdata/bad.cuetestdata/bad.cue
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
diff --git a/testdata/bad.cue b/testdata/bad.cue
index fef8a31e53d5914ca81b3baa8c425654d962a138..5236ab6a31788d122ccadd20fc6293763f5688d2 100644
--- a/testdata/bad.cue
+++ b/testdata/bad.cue
@@ -1,4 +1,4 @@
 s: 1
 i: "1"
 b: 1
-d: 1
+d: "1d"
M testdata/constraints.cuetestdata/constraints.cue
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
diff --git a/testdata/constraints.cue b/testdata/constraints.cue
index e41e0f82ab0868c9dc125529709b755786844dab..87ba7977f1f8b08dd5620e1c0ad9dd20626fecc3 100644
--- a/testdata/constraints.cue
+++ b/testdata/constraints.cue
@@ -1,6 +1,6 @@
-#Duration: string & =~"^([0-9]+(ns|us|µs|ms|s|m|h))+$"
+import "time"
 
 s: string
 i: int
 b: bool
-d: #Duration
+d: time.Duration