local moo = import "moo.jsonnet";
local ns = "test";
local s = moo.oschema.schema(ns);
local nc = moo.oschema.numeric_constraints;
local types = {
trigger_interval: s.number("trigger_interval", dtype="i8", constraints=nc(minimum=10)),
conf : s.record("ConfParams", [
s.field("trigger_interval_ticks", self.trigger_interval, 64000000,
doc="Interval between triggers in 16 ns time ticks (default 1.024 s) ")])
};
moo.oschema.sort_select(types, ns)
with
import moo.io
import moo.otypes
moo.otypes.load_types('test.jsonnet')
import test as t
from pprint import pprint
if __name__=="__main__":
r=t.ConfParams(trigger_interval_ticks=0)
pprint(r.pod())
One "successfully" get:
{'trigger_interval_ticks': 0}
instead of rightfully some error about constraints being violated.
Phil reports:
with
One "successfully" get:
instead of rightfully some error about constraints being violated.