Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

More comprehensive YAML config errors + dynamic checks for action configs #8217

Merged
merged 10 commits into from Jan 27, 2021

Conversation

spacegaier
Copy link
Member

@spacegaier spacegaier commented Jan 24, 2021

Breaking change

Proposed change

To help the users (and prevent questions in Discord 馃槃), this PR improves the config checks, both in general as well as specifically for action configs.

General:

  1. Checks for missing keys (shown in red, same as technical YAML structure errors).
  2. Multiple errors can now be shown (e.g. if multiple fields are missing).
  3. Bump superstruct version since only from 0.10.13 on does the library provide multiple failures so we have multiple error messages.
  4. Incorporates the spelling changes from PR Tweak UI handle-errors text message a bit聽#8211 (but now properly translated) + replaced hardcoded strings with translations.

Action configs:

  1. Make use of dynamic checks in superstruct so we can dynamically enforce the properties depending on the selected action type.

image

action_validation

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@spacegaier spacegaier marked this pull request as draft January 24, 2021 01:32
@spacegaier spacegaier marked this pull request as ready for review January 24, 2021 11:30
@spacegaier
Copy link
Member Author

spacegaier commented Jan 26, 2021

@bramkragten Do you want to check again? I moved the sources files as requested and also adjusted the logic a bit, since handling of unsupported types was wonky (also before my changes). We never properly detected it, once you made changes to he YAML.

Example: Adding a picture-element card meant, you could only save the YAML if you changed at least a single character, since during editor start, we detected that we have no visual editor for that type and showed an error which blocked the saving. As soon as you changed a single character that error was removed (although still the same card type) and you can save.

After:
image

@bramkragten bramkragten merged commit 0a3172d into home-assistant:dev Jan 27, 2021
@bramkragten bramkragten mentioned this pull request Jan 27, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2021
@spacegaier spacegaier deleted the stricter-yaml-config-checks branch February 8, 2021 19:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants