Remove templates from schemas for service fields validation#150063
Conversation
|
Hey there @RaHehl, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
|
Hey there @bdraco, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull Request Overview
This PR improves validation of service fields by streamlining schema definitions and removing unnecessary template validation complexity. The main goal is to simplify service field validation while maintaining functionality for both regular and templated use cases.
Key changes:
- Introduction of streamlined
TARGET_FIELDSschema for LLM serialization - Refactoring of template validation to handle individual key-level templates
- Simplification of service schemas in
homekitandunifiprotectintegrations
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/helpers/config_validation.py |
Adds new TARGET_FIELDS schema and refactors existing service field schemas to separate templated and non-templated versions |
homeassistant/helpers/llm.py |
Updates selector serializer to use new TARGET_FIELDS instead of TARGET_SERVICE_FIELDS |
tests/helpers/test_llm.py |
Updates test expectations to match simplified target schema structure |
homeassistant/components/websocket_api/commands.py |
Removes template validation check that is no longer needed |
homeassistant/components/unifiprotect/services.py |
Simplifies service schemas by removing unnecessary validation wrapping |
homeassistant/components/homekit/__init__.py |
Simplifies unpair service schema to require only device_id |
homeassistant/components/homekit/services.yaml |
Updates service definition to use fields instead of target |
homeassistant/components/homekit/strings.json |
Adds field description for device_id in unpair service |
3e98f88 to
e334200
Compare
|
Changes to |
|
I don't understand why the four bullets are done in the same PR. I'd make 4-5 different PRs if they have no dependencies on each other. |
|
@MartinHjelmare As I started working on it, I've noticed a bunch of other improvements along the way, so this commit grew in scope. You're right that it should be split up. |
e334200 to
8458656
Compare
b564525 to
e3e54c0
Compare
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
emontnemery
left a comment
There was a problem hiding this comment.
LGTM, thanks @arturpragacz 👍
Proposed change
Remove templates from schemas for entity service fields validation.
As the rendering of templates happens before the evaluation of the schema (in here), the schema was adjusted to not contain templates.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: