michielpost / Q42.HueApi

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

v2 GetBehaviorScriptsAsync fails due to deserialization error #309

Closed BenjaminGreene closed 1 year ago

BenjaminGreene commented 1 year ago

The initial implementation of the BehaviorScript model causes deserialization to fail. The *_schema properties are using $ref as a schema reference instead of an object reference, which doesn't seem to be supported by System.Text.Json yet.

Not sure what the best solution would be, but it works if you change them to either JsonElement, or a type like:

public class SchemaReference
{
    [JsonPropertyName("$ref")]
    public string Ref { get; set; }
}
michielpost commented 1 year ago

Thanks. Fixed in version 1.2.0 Went for the JsonElement solution, as it is unclear now what the content of these properties is exactly. But now you can at least work with it.