NEEOInc / neeo-sdk

NEEO Brain SDK
https://neeoinc.github.io/neeo-sdk/
MIT License
48 stars 17 forks source link

Validation of device type at build time #156

Closed tmrobert8 closed 5 years ago

tmrobert8 commented 5 years ago

Various device types have requirements as to what capabilities need to be added and what names need to be applied (or roles). Would be great if the SDK validated the requirements at build time rather than at runtime.

Example: build a MUSICPLAYER type and forget (or misname) one of the required buttons. You can build it and add it to the brain without any issues but when you go to use it - you'll get a fishy error. Since the fishy error doesn't explain what is wrong - you are left double checking and experimentally commenting stuff out until you discover what's wrong.

The SDK should tell you when it's missing a required capability or a required name/role is missing when you build the component (with a message that states what is missing) - would make it much easier to create components then..

MichaelKohler commented 5 years ago

That's what I meant with "What I noticed though is that we should do a better job validating the required sensors, switches, sliders, etc." in https://github.com/NEEOInc/neeo-sdk/issues/146 :)

tmrobert8 commented 5 years ago

Ah - my fault

MichaelKohler commented 5 years ago

As I've already closed the other one, let's keep this one open :)

pfiaux commented 5 years ago

The next release will include a helper to add the player (similar to how button groups work) called .addPlayerWidget({...}) This will make all of the controllers needed explicit and automatically add the necessary buttons and includes a lot of validation with specific errors. (it also covers #113) The player example will be updated to show how it works.

I'm going to close this, we can open specific issues if there are other components missing validation to handle them on case by base basis.