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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow extra values in the slot schema of intent handlers #15246

Merged
merged 1 commit into from Jul 1, 2018

Conversation

dthulke
Copy link
Contributor

@dthulke dthulke commented Jul 1, 2018

Description:

PR #14315 introduced additional slot values for the siteId and probability in the snips component. Unfortunately this caused the schema validation in the IntentHandler to fail for ServiceIntentHandlers used for example by HassTurnOn.
The problem was also reported in issue #14918

As a solution I propose to allow arbitrary extra keys when validating the schema.

Related issue (if applicable): fixes #14918

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>

Example entry for configuration.yaml (if applicable):

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

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

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@dthulke dthulke requested a review from a team as a code owner July 1, 2018 11:53
@homeassistant
Copy link
Contributor

Hi @dthulke,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@balloob
Copy link
Member

balloob commented Jul 1, 2018

Cool, thanks!

CC @tschmidty69

@balloob balloob merged commit 136cc1d into home-assistant:dev Jul 1, 2018
@ghost ghost removed the in progress label Jul 1, 2018
@@ -137,7 +137,8 @@ def async_validate_slots(self, slots):
if self._slot_schema is None:
self._slot_schema = vol.Schema({
key: SLOT_SCHEMA.extend({'value': validator})
for key, validator in self.slot_schema.items()})
for key, validator in self.slot_schema.items()},
extra=vol.ALLOW_EXTRA)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit surprised this was the fix, as SLOT_SCHEMA already had vol.ALLOW_EXTRAS set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SLOT_SCHEMA is the schema for one specific slot (e.g. name). This sets vol.ALLOW_EXTRAS to the schema of the parent object containing all slots.

awarecan pushed a commit to awarecan/home-assistant that referenced this pull request Jul 16, 2018
@balloob balloob mentioned this pull request Jul 20, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Dec 10, 2018
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.

basic snips intent (HassTurnOn/HassTurnOff) no longer is correctly processed
3 participants