From: Sergey Matveev Date: Wed, 18 Jun 2025 18:41:35 +0000 (+0300) Subject: of type X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1a326ceb7a2a2beffb34a4672b53f7531f172075cc6c21a1185ab7bdf7ad66f4;p=keks.git of type --- diff --git a/spec/schema/tcl b/spec/schema/tcl index 8ffd348..96fb3dc 100644 --- a/spec/schema/tcl +++ b/spec/schema/tcl @@ -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 diff --git a/tcl/schema.t/generic.t b/tcl/schema.t/generic.t index a599117..9297741 100755 --- a/tcl/schema.t/generic.t +++ b/tcl/schema.t/generic.t @@ -65,7 +65,7 @@ xxd -r -p data.keks test_expect_success "map various" "$SCHEMA_VALIDATE schema.keks e schema.tcl <schema.keks $root/keks.tcl >data.keks.hex <data.keks test_expect_success "list various" "$SCHEMA_VALIDATE schema.keks e schema.tcl <schema.keks $root/keks.tcl >data.keks.hex < 2} { + lappend _cmds [TYPE [lindex $s 2]] + } else { + lappend _cmds [SCHEMA [lindex $s 1]] } } } diff --git a/tcl/schemas/encrypted.tcl b/tcl/schemas/encrypted.tcl index 6562043..4fae3b7 100644 --- a/tcl/schemas/encrypted.tcl +++ b/tcl/schemas/encrypted.tcl @@ -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 { diff --git a/tcl/schemas/hashed.tcl b/tcl/schemas/hashed.tcl index 7504f19..ca0c9ec 100644 --- a/tcl/schemas/hashed.tcl +++ b/tcl/schemas/hashed.tcl @@ -1 +1 @@ -hashed {{field . {map} {of bin} >0}} +hashed {{field . {map} {of type bin} >0}} diff --git a/tcl/schemas/pub-load.tcl b/tcl/schemas/pub-load.tcl index 167cac5..dbc7d8f 100644 --- a/tcl/schemas/pub-load.tcl +++ b/tcl/schemas/pub-load.tcl @@ -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} } diff --git a/tcl/schemas/signed.tcl b/tcl/schemas/signed.tcl index 1d9160a..ce17fab 100644 --- a/tcl/schemas/signed.tcl +++ b/tcl/schemas/signed.tcl @@ -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 {