-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust REST schema validation #81723
Conversation
A hard fail is better here since it can be caught by a configuration check and the error doesn't get hidden away leaving the user to guess what went wrong. It just isn't so much fun on an upgrade. I'd go back an relabel the existing case a breaking change and update the release notes so it makes the one time pain a bit easier to resolve. |
Why would an empty test block be a fail? It should just be a loaded component with no configured sensors. |
If the schema validation returned an empty list that would work. But I'm not sure how to adjust it accordingly. |
I think it's a bug that it can't cope with an empty included file. I also have
And my "groups.yaml" file is empty, but there is no error. So I think it needs to be able to cope with empty file without an error or warning. |
I think the latest commit 7bd7b2f resolve this issue. If an empty dict is passed to the schema validation, it now gets converted to an empty list. Without this patch, it was being converted to a list with a single dict with injected defaults: |
Proposed change
Linked to #81551
In 2022.10, passing an empty configuration to
rest
resulted in a successful setup, with a failing coordinator and no sensors.rest:
In 2022.11, code was adjusted on the coordinator to ensure we had a valid resource before creating the dataclass, which resulted in a
HomeAssistantError
:The side effect of this change is that it highlited invalid configurations in the real world (previously throwing errors in logs, but probably ignored, now failing).
This PR adjusts the schema validation to ensure an empty dict first gets converted to an empty list rather than get converted to a list with a single dict
Type of change
Additional information
Checklist
black --fast 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
..coveragerc
.To help with the load of incoming pull requests: