RageAgainstThePixel / com.rest.elevenlabs

A non-official Eleven Labs voice synthesis client for Unity (UPM)
https://elevenlabs.io/?from=partnerbrown9849
MIT License
74 stars 9 forks source link

Plugin fails deserializing voices #40

Closed tomkail closed 10 months ago

tomkail commented 10 months ago

Hello! I'm on the latest package.

When the inspector is looking at the Eleven Labs Configuration file or trying to load voices in the Dashboard, it repeatedly throws the error: Newtonsoft.Json.JsonSerializationException: A member with the name 'name' already exists on 'ElevenLabs.Voices.Voice'. Use the JsonPropertyAttribute to specify another name.

image
StephenHodgson commented 10 months ago

Interesting, I didn't change too much with voices

🤔

tomkail commented 10 months ago

I've just fixed it by adding an underscore to the "name" backing field. I think the issue is that JSON.Net has been told to serialize the json property "name" into the property "Name", but because there's a field explicitly called "name" it's unsure which to write the json data into.

Same issue exists in VoiceSettings on stability and style.

image
StephenHodgson commented 10 months ago

It sounds like they changed something with the API itself.

Last time I ran this it wasn't a problem

StephenHodgson commented 10 months ago

I don't use underscore prefixes in member names, we ill probably come up with something else.

But I would also like an example to try and repro.

StephenHodgson commented 10 months ago

Did you somehow change the json serialization settings?

Bc the fields should be ignored by default

tomkail commented 10 months ago

I haven't changed the json serialization settings used by the package, but it's possible our app replaces the default settings? I don't believe that would matter though, since you use ElevenLabsClient.JsonSerializationOptions on DeserializeObject

StephenHodgson commented 10 months ago

Hmm interesting bc I have not changed the implementation details of this class in almost 8 months, except for adding the name parameter to the constructor.

tomkail commented 10 months ago

Ahh I've got it. This plugin adds a contract that serializes private types, even if marked with JsonIgnore. https://github.com/applejag/Newtonsoft.Json-for-Unity.Converters