schema is not mandatory
This commit is contained in:
parent
f48878b324
commit
14bd5e8829
|
@ -225,6 +225,7 @@ class _Value:
|
||||||
withwarning: bool=False,
|
withwarning: bool=False,
|
||||||
flatten: bool=False):
|
flatten: bool=False):
|
||||||
ret = {}
|
ret = {}
|
||||||
|
if self.schema:
|
||||||
self._dict_walk(ret,
|
self._dict_walk(ret,
|
||||||
self.schema,
|
self.schema,
|
||||||
self.path,
|
self.path,
|
||||||
|
@ -609,9 +610,12 @@ class ContextValue(_Value):
|
||||||
config: 'Config',
|
config: 'Config',
|
||||||
schema: Dict) -> None:
|
schema: Dict) -> None:
|
||||||
self.config = config
|
self.config = config
|
||||||
|
if schema:
|
||||||
first = next(iter(schema.keys()))
|
first = next(iter(schema.keys()))
|
||||||
self.path = first.rsplit('.', 1)[0]
|
self.path = first.rsplit('.', 1)[0]
|
||||||
self.schema = {'properties': schema}
|
self.schema = {'properties': schema}
|
||||||
|
else:
|
||||||
|
self.schema = {}
|
||||||
|
|
||||||
def __call__(self) -> TiramisuOptionValue:
|
def __call__(self) -> TiramisuOptionValue:
|
||||||
return TiramisuOptionValue(self.config,
|
return TiramisuOptionValue(self.config,
|
||||||
|
|
Loading…
Reference in New Issue