diff --git a/doc/variable/simple.md b/doc/variable/simple.md
index b481d51d..aaea1045 100644
--- a/doc/variable/simple.md
+++ b/doc/variable/simple.md
@@ -36,7 +36,7 @@ Une variable a un type. Ce type permet de définir les valeurs acceptées par ce
- string : chaine de caractère (type par défaut)
- number : un nombre
- float : un chiffre flottant
-- boolean : "True" ou "False", si aucune valeur n'est défini la valeur par défaut de cette variable sera "True"
+- boolean : "True" ou "False", si aucune valeur n'est défini la valeur par défaut de cette variable sera "True", ces variables sont également obligatoire par défaut
- password : un mot de passe
- mail : une adresse mail
- filename : nom de fichier au sens Unix (exemple : "/etc/passwd")
@@ -107,6 +107,12 @@ Variable dont une valeur est requise :
```
+Les variables booléans sont par défaut obligatoire. Pour qu'une variable booléan ne soit pas obligatoire il faut le préciser explicitement :
+
+```
+
+```
+
## Valeur par défaut d'une variable
Il est possible de fixer les valeurs par défaut d'une variable :
diff --git a/src/rougail/annotator/value.py b/src/rougail/annotator/value.py
index 8e479f6e..7496f47c 100644
--- a/src/rougail/annotator/value.py
+++ b/src/rougail/annotator/value.py
@@ -73,7 +73,7 @@ class ValueAnnotator(Walk): # pylint: disable=R0903
if value.type == 'calculation':
has_value = False
break
- if has_value:
+ if has_value and 'mandatory' not in vars(variable):
# if has value without any calculation
variable.mandatory = True
if not hasattr(variable, 'value'):
diff --git a/tests/dictionaries/01boolean_no_mandatory/00-base.xml b/tests/dictionaries/01boolean_no_mandatory/00-base.xml
new file mode 100644
index 00000000..663cb3b9
--- /dev/null
+++ b/tests/dictionaries/01boolean_no_mandatory/00-base.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
diff --git a/tests/dictionaries/01boolean_no_mandatory/__init__.py b/tests/dictionaries/01boolean_no_mandatory/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/dictionaries/01boolean_no_mandatory/makedict/base.json b/tests/dictionaries/01boolean_no_mandatory/makedict/base.json
new file mode 100644
index 00000000..9c4e49a9
--- /dev/null
+++ b/tests/dictionaries/01boolean_no_mandatory/makedict/base.json
@@ -0,0 +1,3 @@
+{
+ "rougail.my_variable": true
+}
diff --git a/tests/dictionaries/01boolean_no_mandatory/tiramisu/base.py b/tests/dictionaries/01boolean_no_mandatory/tiramisu/base.py
new file mode 100644
index 00000000..a3e141bb
--- /dev/null
+++ b/tests/dictionaries/01boolean_no_mandatory/tiramisu/base.py
@@ -0,0 +1,16 @@
+from importlib.machinery import SourceFileLoader
+from importlib.util import spec_from_loader, module_from_spec
+loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
+spec = spec_from_loader(loader.name, loader)
+func = module_from_spec(spec)
+loader.exec_module(func)
+for key, value in dict(locals()).items():
+ if key != ['SourceFileLoader', 'func']:
+ setattr(func, key, value)
+try:
+ from tiramisu3 import *
+except:
+ from tiramisu import *
+option_2 = BoolOption(name="my_variable", doc="my_variable", default=True, properties=frozenset({"normal"}))
+option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
+option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])