Next: , Previous: , Up: KEKS   [Index]


Schemas

Although KEKS can be decoded without any schema definition/specification, data structures are likely to be checked against some kind of the schema. Here is suggestion (not a requirement!) to use relatively simple data structure validation specifications/schemas.

How are data structures checked? You check if they have required fields, have necessary types of fields, satisfying lengths of the lists/maps or strings, and so on. In most cases those checks covers nearly everything when you sanitise the structures.

So suggestion is to specify those steps for some kind of very simple minimalistic validation machine, that interprets them, executing validation commands against the provided data structures. That "machine" should be simple enough to be able to implement it quickly and with sane amount of code. Validation steps should be easily decodable and conveniently parsed even in C-language.

Let’s use KEKS format itself for the serialised validation steps! And generate them from higher level language/code, convenient for humans.

Tcl-schema -> keks-encode(validation-commands)
     validate(keks-decode(validation-commands), keks-decode(data))
SchemaCmds:  Schema commands
SchemaTcl:  Tcl-written schemas