rougail-output-doc/tests/docs/examples/24_7validators_variable_optional.md

54 lines
970 B
Markdown
Raw Normal View History

2024-11-15 08:13:45 +01:00
---
gitea: none
include_toc: true
---
# dictionaries/rougail/00-base.yml
```yaml
---
version: '1.1'
general: # a family
int:
description: a first number
type: number
test:
- 5
validators:
- jinja: |
{% if _.int == int2 %}
int and int2 must be different
{% endif %}
params:
int2:
variable: _.int2
optional: true
description: int and int2 must be different
- jinja: |
{% if int3 is defined and _.int == int3 %}
int and int3 must be different
{% endif %}
params:
int3:
variable: _.int3
optional: true
description: int and int3 must be different
int2: 1 # a second number
```
# Example with mandatory variables not filled in
```yaml
---
rougail:
general:
int: 5
```
# Example with all variables modifiable
```yaml
---
rougail:
general:
int: 5
int2: 1
```