ambient-weather / api-docs

AmbientWeather.net API Documentation
65 stars 43 forks source link

Consistent device data model #2

Closed mpfilbin closed 6 years ago

mpfilbin commented 6 years ago

Hello, I am working on implementing a Ruby SDK for the Ambient Weather API, and I have a question about the device data model.

I was reviewing some documentation in the project wiki which indicates that some fields may not be present in the resulting JSON depending on whether a given device supports it. Would you consider returning a complete object (e.g., all possible fields that may be supported) and null out values that are not available for the given device? I wonder if it may make it easier for consumers of the API to deserialize the JSON payload into a consistent model. What are your thoughts?

Thank you.

lrosenman commented 6 years ago

Take a look at what I do with the Go library I did: https://github.com/lrosenman/ambient

owise1 commented 6 years ago

I'm not sure it's best for us to do this on our end. How hard would it be to do something like @lrosenman suggested in Ruby?

mpfilbin commented 6 years ago

Thanks for the suggestion @lrosenman, I'll follow your example.

@owise1 it should be trivial to implement all the fields on the client, I was thinking more about helping developers discover what the potential fields could be. The mock response from Apiary doesn't seem to contain all of the fields that could be supported and had Larry not pointed me towards the Device Data Specs page in the wiki I wouldn't have known. If you think it's valuable, maybe the simplest solution is to just update the README and/or the Apiary markdown file with a link directly to those specs.

owise1 commented 6 years ago

That's a good suggestion. I've updated the API docs