michielpost / Q42.HueApi

C# helper library to talk to the Philips Hue bridge
MIT License
411 stars 114 forks source link

Removed DataMember/added JsonIgnore attributes in Id properties in Hue models #246

Closed Mephistofeles closed 3 years ago

Mephistofeles commented 3 years ago

As far as I know, Hue never returns id in the object's body. Id is returned as a dictionary key and it is set in this library accordingly, for example in HueClient-Lights:

if (light != null)
  light.Id = id;

I use the models from this library to recreate Hue API, and DataMember/JsonProperty attributes on these properties results in incorrect responses. This change should correct this without affecting other use cases.

michielpost commented 3 years ago

Thanks. Looks right. I think I'm going to delete all [DataContract] and [DataMember] attributes, they are a remnant from the past. I will replace them with '[JsonProperty]'. And I think I can use [JsonIgnore] on all the Id properties.

Would that cause problems for you?

Mephistofeles commented 3 years ago

No, JsonIgnore works fine.