mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Add TARGET_FIELDS to config validation (#150238)
This commit is contained in:
@@ -1216,43 +1216,14 @@ async def test_selector_serializer(
|
||||
selector.StateSelector({"entity_id": "sensor.test"})
|
||||
) == {"type": "string"}
|
||||
target_schema = selector_serializer(selector.TargetSelector())
|
||||
target_schema["properties"]["entity_id"]["anyOf"][0][
|
||||
"enum"
|
||||
].sort() # Order is not deterministic
|
||||
assert target_schema == {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"area_id": {
|
||||
"anyOf": [
|
||||
{"type": "string", "enum": ["none"]},
|
||||
{"type": "array", "items": {"type": "string", "nullable": True}},
|
||||
]
|
||||
},
|
||||
"device_id": {
|
||||
"anyOf": [
|
||||
{"type": "string", "enum": ["none"]},
|
||||
{"type": "array", "items": {"type": "string", "nullable": True}},
|
||||
]
|
||||
},
|
||||
"entity_id": {
|
||||
"anyOf": [
|
||||
{"type": "string", "enum": ["all", "none"], "format": "lower"},
|
||||
{"type": "string", "nullable": True},
|
||||
{"type": "array", "items": {"type": "string"}},
|
||||
]
|
||||
},
|
||||
"floor_id": {
|
||||
"anyOf": [
|
||||
{"type": "string", "enum": ["none"]},
|
||||
{"type": "array", "items": {"type": "string", "nullable": True}},
|
||||
]
|
||||
},
|
||||
"label_id": {
|
||||
"anyOf": [
|
||||
{"type": "string", "enum": ["none"]},
|
||||
{"type": "array", "items": {"type": "string", "nullable": True}},
|
||||
]
|
||||
},
|
||||
"area_id": {"items": {"type": "string"}, "type": "array"},
|
||||
"device_id": {"items": {"type": "string"}, "type": "array"},
|
||||
"entity_id": {"items": {"type": "string"}, "type": "array"},
|
||||
"floor_id": {"items": {"type": "string"}, "type": "array"},
|
||||
"label_id": {"items": {"type": "string"}, "type": "array"},
|
||||
},
|
||||
"required": [],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user