Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
accept boolean or anything default accept null also for full dicts added some common validators more simple validators support multi_conf better handle automations updates updates handle lists removed not needed class move to own folder generalized for automations lists, etc updates updates clean up clean up fix automations made comment optional basic docs support added more docs fixes docs handling updates updates fix components parent updates updates updates Fix inkplate 6 registration updates Disable logging for vscode add on better handle buses keep extended order as in CONFIGs updates updates updates disable comments moved to scripts/build_jsonschema added configurable decorators path handling fix handle list_schema fixes and cleanup add jschema_extractor to maybe updates lint no schema in git add generated loggers list
- Loading branch information
Showing
11 changed files
with
770 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# These are a helper decorators to help get schema from some | ||
# components which uses volutuous in a way where validation | ||
# is hidden in local functions | ||
|
||
# These decorators should not modify at all what the functions | ||
# originally do. | ||
# | ||
# However there is a property to further disable decorator | ||
# impat. | ||
# | ||
# This is set to true by script/build_jsonschema.py | ||
# only, so data is collected (again functionality is not modified) | ||
EnableJsonSchemaCollect = False | ||
|
||
extended_schemas = {} | ||
list_schemas = {} | ||
registry_schemas = {} | ||
hidden_schemas = {} | ||
typed_schemas = {} | ||
|
||
|
||
def jschema_extractor(validator_name): | ||
if EnableJsonSchemaCollect: | ||
def decorator(func): | ||
hidden_schemas[str(func)] = validator_name | ||
return func | ||
return decorator | ||
|
||
def dummy(f): | ||
return f | ||
return dummy | ||
|
||
|
||
def jschema_extended(func): | ||
if EnableJsonSchemaCollect: | ||
def decorate(*args, **kwargs): | ||
ret = func(*args, **kwargs) | ||
assert len(args) == 2 | ||
extended_schemas[str(ret)] = args | ||
return ret | ||
return decorate | ||
|
||
return func | ||
|
||
|
||
def jschema_composite(func): | ||
if EnableJsonSchemaCollect: | ||
def decorate(*args, **kwargs): | ||
ret = func(*args, **kwargs) | ||
# args length might be 2, but 2nd is always validator | ||
list_schemas[str(ret)] = args | ||
return ret | ||
return decorate | ||
|
||
return func | ||
|
||
|
||
def jschema_registry(registry): | ||
if EnableJsonSchemaCollect: | ||
def decorator(func): | ||
registry_schemas[str(func)] = registry | ||
return func | ||
return decorator | ||
|
||
def dummy(f): | ||
return f | ||
return dummy | ||
|
||
|
||
def jschema_typed(func): | ||
if EnableJsonSchemaCollect: | ||
def decorate(*args, **kwargs): | ||
ret = func(*args, **kwargs) | ||
typed_schemas[str(ret)] = (args, kwargs) | ||
return ret | ||
return decorate | ||
|
||
return func |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.