Merge "Add a modulo core constraint"
This commit is contained in:
@@ -251,6 +251,12 @@ the end user.
|
||||
Constrains a numerical value. Applicable to INTEGER and NUMBER.
|
||||
Both ``min`` and ``max`` default to ``None``.
|
||||
|
||||
*Modulo(step, offset, description)*:
|
||||
Starting with the specified ``offset``, every multiple of ``step`` is a valid
|
||||
value. Applicable to INTEGER and NUMBER.
|
||||
|
||||
Available from template version 2017-02-24.
|
||||
|
||||
*CustomConstraint(name, description, environment)*:
|
||||
This constructor brings in a named constraint class from an
|
||||
environment. If the given environment is ``None`` (its default)
|
||||
|
||||
@@ -532,6 +532,24 @@ following range constraint would allow for all numeric values between 0 and
|
||||
|
||||
range: { min: 0, max: 10 }
|
||||
|
||||
modulo
|
||||
++++++
|
||||
The ``modulo`` constraint applies to parameters of type ``number``. The value
|
||||
is valid if it is a multiple of ``step``, starting with ``offset``.
|
||||
|
||||
The syntax of the ``modulo`` constraint is
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
modulo: { step: <step>, offset: <offset> }
|
||||
|
||||
Both ``step`` and ``offset`` must be specified.
|
||||
|
||||
For example, the following modulo constraint would only allow for odd numbers
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
modulo: { step: 2, offset: 1 }
|
||||
|
||||
allowed_values
|
||||
++++++++++++++
|
||||
|
||||
Reference in New Issue
Block a user