Rename _validate_structure to _validate_schema

This commit is contained in:
Allen Porter 2025-07-03 21:32:10 +00:00
parent 789eb029fa
commit afa30be64b

View File

@ -59,8 +59,8 @@ STRUCTURE_FIELD_SCHEMA = vol.Schema(
) )
def _validate_structure(value: dict[str, Any]) -> vol.Schema: def _validate_schema(value: dict[str, Any]) -> vol.Schema:
"""Validate the structure for the generate data task.""" """Validate the structure for the generate data task and convert to a vol Schema."""
if not isinstance(value, dict): if not isinstance(value, dict):
raise vol.Invalid("Structure must be a dictionary") raise vol.Invalid("Structure must be a dictionary")
fields = {} fields = {}
@ -92,7 +92,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
vol.Required(ATTR_INSTRUCTIONS): cv.string, vol.Required(ATTR_INSTRUCTIONS): cv.string,
vol.Optional(ATTR_STRUCTURE): vol.All( vol.Optional(ATTR_STRUCTURE): vol.All(
vol.Schema({str: STRUCTURE_FIELD_SCHEMA}), vol.Schema({str: STRUCTURE_FIELD_SCHEMA}),
_validate_structure, _validate_schema,
), ),
} }
), ),