I want to validate that intervals should be monotonically increasing and the start time of the next interval should be the end time of the previous interval. Is it possible? I couldn't find an example of it.
If I write a code for it, it'll be the following:
for (int i = 1; i < msg.intervalValues.size(); i ++) {
IntervalValue prevValue = msg.intervalValues.get(i-1);
IntervalValue currentValue = msg.intervalValues.get(i);
if (currentValue.getInterval().getStartTime() != prevValue.getInterval().getEndTime()) {
throw ValidationFailedException()
}
}
Hi @rishabh2a! CEL expressions do not support loop operations of this kind currently. Take a look at the builtin macros for what's possible in a custom constraint.
Suppose, my proto file is:
I want to validate that intervals should be monotonically increasing and the start time of the next interval should be the end time of the previous interval. Is it possible? I couldn't find an example of it.
If I write a code for it, it'll be the following: