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

action.devices.traits.TemperatureSetting has both properties and onOf #4

Open
casper2002casper opened this issue Dec 21, 2020 · 2 comments

Comments

@casper2002casper
Copy link

action.devices.traits.TemperatureSetting has both properties and onOf, seeing as no other trait has this, this seems like a mistake.

@i8beef
Copy link

i8beef commented Dec 22, 2020

It looks weird, but its valid JSON schema. It indicates that the "properties" are independently available for use at that level, while the "oneOf" are exclusionary (its only valid if its only using ONE of the designated combinations of properties). Threw me off at first too.

@proppy
Copy link
Collaborator

proppy commented Jan 12, 2021

Are your referring to https://github.com/actions-on-google/smart-home-schema/blob/master/traits/temperaturesetting/temperaturesetting.states.schema.json ?

@i8beef interpretation is correct, the properties refer to the common properties while the oneOf provide additional contraints for validating other properties that depends on attributes. Maybe this could be made clearier with the usage of an additionalProperties subschemas.

Alternatively because the oneOf currently already duplicate some of the properties we would rely on a top-level oneOf and duplicate the common properties.

Other schema that uses a similar pattern are:
https://github.com/actions-on-google/smart-home-schema/blob/3afb14dff2d5c2150e037b501e86ba9b2fdbc031/traits/colorsetting/colorabsolute.params.schema.json
https://github.com/actions-on-google/smart-home-schema/blob/9ba20d2520e4639c7e0866df5543e215691f0a4e/traits/sensorstate/sensorstate.states.schema.json
https://github.com/actions-on-google/smart-home-schema/blob/9ba20d2520e4639c7e0866df5543e215691f0a4e/traits/sensorstate/sensorstate.attributes.schema.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants