RustyNova016/musicbrainz_rs_nova

Serialize for `SearchResult<T>` broken

Closed this issue · 3 comments

This is a follow up to #29. Thanks to the fixes, it now works fine for releases.

However, if I serialize a SearchResult<Release> and then deserialize it again, I\m getting the following error:

JSON error: unknown field `entities`, expected one of `created`, `count`, `offset`, `artists` at line 1 column 74

Use Case: I'm building a cache implementation for an application I'm working on to reduce the load on MusicBrainz servers.

Search results have a custom deserializer so yeah it's going to break. I'll see what I can do as I never tried custom de/serializers before.

But good luck on your cache! I tried to make one myself using cacache + bit serialising and it was so painful still that I'm just going SQLite...

Alright, I tried to do it, but I have not enough knowledge in serializers to actually do it.

What I could suggest is maybe create a SearchResultDe similar to the original that can deserialize from the badly serialized json. Then add a From to convert to a standard search result.

This one is definitely a "need help"

Fixed in 568789b