Support None schema in EntityPlatform.async_register_entity_service (#123064)

This commit is contained in:
Erik Montnemery
2024-08-14 10:46:29 +02:00
committed by GitHub
parent 5f967fdee2
commit 7063541733
3 changed files with 32 additions and 4 deletions

View File

@ -1275,7 +1275,7 @@ BASE_ENTITY_SCHEMA = _make_entity_service_schema({}, vol.PREVENT_EXTRA)
def make_entity_service_schema(
schema: dict, *, extra: int = vol.PREVENT_EXTRA
schema: dict | None, *, extra: int = vol.PREVENT_EXTRA
) -> vol.Schema:
"""Create an entity service schema."""
if not schema and extra == vol.PREVENT_EXTRA:
@ -1283,7 +1283,7 @@ def make_entity_service_schema(
# the base schema and avoid compiling a new schema which is the case
# for ~50% of services.
return BASE_ENTITY_SCHEMA
return _make_entity_service_schema(schema, extra)
return _make_entity_service_schema(schema or {}, extra)
SCRIPT_CONVERSATION_RESPONSE_SCHEMA = vol.Any(template, None)