]> Cypherpunks repositories - keks.git/commitdiff
of type
authorSergey Matveev <stargrave@stargrave.org>
Wed, 18 Jun 2025 18:41:35 +0000 (21:41 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 18 Jun 2025 18:41:42 +0000 (21:41 +0300)
spec/schema/tcl
tcl/schema.t/generic.t
tcl/schema.tcl
tcl/schemas/encrypted.tcl
tcl/schemas/hashed.tcl
tcl/schemas/pub-load.tcl
tcl/schemas/signed.tcl

index 8ffd34819c42c8dc1e86e3f97cd47ec2e347441a070e7f60bf986bae0dbaa48f..96fb3dc40b7d48fde55a9b789ed0edb551197e82f69f15a599c365dea6c5b5be 100644 (file)
@@ -67,8 +67,10 @@ integer values, you choose one of: s, ms, us, ns, ps, fs.
 "utc" issues UTC command.
 
 {of s} argument issues checking of EACH element of the list or map
-against the specified schema, or against specified type if "s" is a
-known type.
+against the specified schema "s".
+
+{of type t} argument issues checking of EACH element of the list or map
+against the specified type "t".
 
 "schema-include filename.tcl" command used instead of "field" allows
 inclusion of the specified file with the path relative to given schema
index a599117cce604ff14661907ae2c2c7ea15e755798ac7880828ae98c97d1f5be4..92977417a4a9d74f1779f07652e7344e61c2ab803a2ce0b779223de3914b3c69 100755 (executable)
@@ -65,7 +65,7 @@ xxd -r -p <data.keks.hex >data.keks
 test_expect_success "map various" "$SCHEMA_VALIDATE schema.keks e <data.keks"
 
 cat >schema.tcl <<EOF
-e {{field . {map} {of int}}}
+e {{field . {map} {of type int}}}
 EOF
 $root/schema.tcl schema.tcl | xxd -r -p >schema.keks
 $root/keks.tcl >data.keks.hex <<EOF
@@ -104,7 +104,7 @@ xxd -r -p <data.keks.hex >data.keks
 test_expect_success "list various" "$SCHEMA_VALIDATE schema.keks e <data.keks"
 
 cat >schema.tcl <<EOF
-e {{field . {list} {of int}}}
+e {{field . {list} {of type int}}}
 EOF
 $root/schema.tcl schema.tcl | xxd -r -p >schema.keks
 $root/keks.tcl >data.keks.hex <<EOF
index 4ceae5c499a03fe432006073327f1340818f6ca75c33f72c2e0fc5c486c5178a..d8b9cf2feb1643e7f231355c52e6463799d9d3aed399fc5f585ce5cda1824af0 100755 (executable)
@@ -103,13 +103,12 @@ proc field {k types args} {
     }
     set i [lsearch -glob $args "of *"]
     if {$i != -1} {
-        set s [lindex [lindex $args $i] 1]
         lappend _cmds [EACH]
-        variable knownTypes
-        if {[lsearch -exact $knownTypes $s] == -1} {
-            lappend _cmds [SCHEMA $s]
-        } {
-            lappend _cmds [TYPE $s]
+        set s [lindex $args $i]
+        if {[llength $s] > 2} {
+            lappend _cmds [TYPE [lindex $s 2]]
+        } else {
+            lappend _cmds [SCHEMA [lindex $s 1]]
         }
     }
 }
index 656204382869e827453934f044b92950432aacc3f00fc2cd8ff83365a44a1964..4fae3b71c231284511eb9c623c8a7cf3a6210a440d7183a039e43886850990cb 100644 (file)
@@ -3,7 +3,7 @@ encrypted {
     {field kem {list} {of kem} >0}
     {field id {hexlet} optional}
     {field payload {bin} optional}
-    {field pubs {list} {of map} optional >0} {# attached public keys}
+    {field pubs {list} {of type map} optional >0} {# attached public keys}
 }
 
 dem {
index 7504f19b21d36c6481926414f9adaeec7d8a465725f0f82af413d5936fa1efe0..ca0c9ec59094222d9b9238aded251c90a592676047118dd82a7313ecbb29217f 100644 (file)
@@ -1 +1 @@
-hashed {{field . {map} {of bin} >0}}
+hashed {{field . {map} {of type bin} >0}}
index 167cac584e9d323bbe18730e2e28b648454a8ff87a94a9905cb8e5d7606e598a..dbc7d8f0a7b23ba6a4fa6f87257e515c0581f3fa8278eef38fc771006c5a8e28 100644 (file)
@@ -4,5 +4,5 @@ pub-load {
     {field crit {} !exists}
     {field ku {set} >0 optional}
     {field pub {list} {of av} >0}
-    {field sub {map} {of str} >0}
+    {field sub {map} {of type str} >0}
 }
index 1d9160a8ec8911713ba74fd915b516bda0dce5a97bb5fbf270f56021f3f710c2..ce17fab9ba5e37dd76341219392f8d1b4aecb3200619b5d8a88cd1b7848cd64c 100644 (file)
@@ -4,7 +4,7 @@ schema-include fpr.tcl
 signed {
     {field load {with load}}
     {field sigs {list} {of sig} >0 optional}
-    {field pubs {list} {of map} >0 optional}
+    {field pubs {list} {of type map} >0 optional}
 }
 
 load {