Page MenuHomeVyOS Platform

Add constraintGroup for combining validators with logical AND
Needs testing, NormalPublic

Description

Proposal, copied from comments in T2759.

XML - current implementation:

<constraint>
  <validator name="numeric" argument="--range 1-65535"/>
</constraint>

XML - new implementation:

<constraint>
  .. validator node 1 ...
  <errorMessage>This is bad</errorMessage>
</constraint>
<constraint>
  .. validator node 2 ...
  <errorMessage>This is bad</errorMessage>
</constraint>

Only once <validator> should be supported per <constraint>

<constraintGroup>
  .. validator node 1 ...
  .. validator node 2 ...
  <errorMessage>This is bad</errorMessage>
</constraintGroup>

All constraints in <constraint> are run as logical OR, all validators under the <constraintGroup> node are run with a logical AND.

Having both constraint and constraintGroup will OR both together.

Details

Difficulty level
Unknown (require assessment)
Version
vyos-1.4
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible

Event Timeline

Needs testing, but initial implementation here:

https://github.com/jestabro/vyos-utils/tree/T3574
https://github.com/jestabro/vyos-1x/tree/T3574

Departing from the outline in the description, this implementation has only zero or one <constraint> elements, in which all validators are OR'd; in keeping with the description it allows zero or more <constraintGroup> elements, in each of which all validators are AND'd; the elements themselves are OR'd.

Adopting the convention in the description would be a simple change.

jestabro changed the task status from Open to Needs testing.May 23 2021, 8:43 PM
jestabro triaged this task as Normal priority.