schema is not mandatory

This commit is contained in:
Emmanuel Garette 2020-03-14 08:43:18 +01:00
parent f48878b324
commit 14bd5e8829
1 changed files with 14 additions and 10 deletions

View File

@ -225,13 +225,14 @@ class _Value:
withwarning: bool=False, withwarning: bool=False,
flatten: bool=False): flatten: bool=False):
ret = {} ret = {}
self._dict_walk(ret, if self.schema:
self.schema, self._dict_walk(ret,
self.path, self.schema,
fullpath, self.path,
withwarning, fullpath,
flatten, withwarning,
None) flatten,
None)
return ret return ret
@ -609,9 +610,12 @@ class ContextValue(_Value):
config: 'Config', config: 'Config',
schema: Dict) -> None: schema: Dict) -> None:
self.config = config self.config = config
first = next(iter(schema.keys())) if schema:
self.path = first.rsplit('.', 1)[0] first = next(iter(schema.keys()))
self.schema = {'properties': schema} self.path = first.rsplit('.', 1)[0]
self.schema = {'properties': schema}
else:
self.schema = {}
def __call__(self) -> TiramisuOptionValue: def __call__(self) -> TiramisuOptionValue:
return TiramisuOptionValue(self.config, return TiramisuOptionValue(self.config,