Open timcanham opened 2 years ago
Looks good. I was thinking of [ <min> , <max> ]
as the notation, similar to the notation for a closed interval <min> <= x <= <max>
in math. One could also use ( <min> , <max> )
for an open interval <min> < x < <max>
, or mix closed and open bounds.
Sure - how would you represent one end being open, i.e. x < 10, x > 2.9?
x < 10
could be ( , 10 )
as you said. Or maybe ( _, 10 )
.
We are working on a prototype of this that uses FPP annotations to express the constraints. The current thinking is
command C(
a: U32 in [0,10] # >= 0 and <= 10
b: I32 in (-10,10) # > -10 and < 10
c: F32 in (--, 42) # No lower bound; must be < 42
)
Are there any plans to add message validator generation? Would it be in the autogenerated code or in the implmentation boilerplate?
From what I understand, F´´ currently guarantees structured data types but cannot apply semantic rules for values.
The generated code should also support validation of these constraints.
I expect to have something like the protoc-gen-validate plugin made by EnvoyProxy for adding these message validators to the Google's protobuf.
Add range a range check field to help the sequence tool and code generator check argument ranges. Something like:
where the notation is
<min>-<max>
if
<min>
or<max>
are not specified, then that end of the range is not checked.