Allow custom options without validate (#80)

This commit is contained in:
Pascal Vizeli 2017-06-17 22:47:56 +02:00 committed by GitHub
parent 6d23f3bd1c
commit 01d18d5ff3
2 changed files with 6 additions and 4 deletions

View File

@ -393,5 +393,7 @@ class AddonsData(Config):
"""Create a schema for addon options."""
raw_schema = self._system_data[addon][ATTR_SCHEMA]
schema = vol.Schema(vol.All(dict, validate_options(raw_schema)))
return schema
if isinstance(raw_schema, bool):
return vol.Schema(dict)
return vol.Schema(vol.All(dict, validate_options(raw_schema)))

View File

@ -62,11 +62,11 @@ SCHEMA_ADDON_CONFIG = vol.Schema(vol.All({
vol.Optional(ATTR_ENVIRONMENT): {vol.Match(r"\w*"): vol.Coerce(str)},
vol.Optional(ATTR_PRIVILEGED): [vol.In(PRIVILEGE_ALL)],
vol.Required(ATTR_OPTIONS): dict,
vol.Required(ATTR_SCHEMA): {
vol.Required(ATTR_SCHEMA): vol.Any({
vol.Coerce(str): vol.Any(ADDON_ELEMENT, [
vol.Any(ADDON_ELEMENT, {vol.Coerce(str): ADDON_ELEMENT})
])
},
}, False),
vol.Optional(ATTR_IMAGE): vol.Match(r"\w*/\w*"),
}, check_network), extra=vol.ALLOW_EXTRA)