-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ITelevisionApi GetAlternativeTitlesAsync does not deserialize titles collection #27
Comments
{"id":1399,"results":[]}
{"id":550,"titles":[]} Both endpoint deserialized to |
Maybe to prevent similar issues in the future, it would be beneficial to turn strict json deserialization on (maybe other tests will fail now, or if TMDb devs change something the test cases will fail so we could fix it ASAP). |
My idea (i didn't prototyped it)
public interface IJsonDeserializer
{
TmdbEasyModel DeserializeTo<TmdbEasyModel>(string json);
IChangeListDeserializer ForChangeList();
}
public interface IChangeListDeserializer
{
Change Deserialize(string json);
}
The next problem will be how and where to bind the internal async Task<TmdbEasyModel> ExecuteAsync<TmdbEasyModel>(Request request)
{
string uri = request.GetUri();
string json = await _httpClient.GetStringAsync(uri).ConfigureAwait(false);
return _client.Options.JsonDeserializer.DeserializeTo<TmdbEasyModel>(json);
}
internal async Task<TmdbEasyModel> ExecuteAsync<TmdbEasyModel>(Request request, IChangeListDeserializer deserializer)
{
string uri = request.GetUri();
string json = await _httpClient.GetStringAsync(uri).ConfigureAwait(false);
return deserializer.Deserialize<TmdbEasyModel>(json);
} |
Shall we continue this chat in #31. I like your idea, except for the last bit (moving the httpclient up a layer, it needs to sit in the TmdbEasyClient. Also as we add more Serializers we will end up needing more and more methods. Would be good to find a way to design this so future adding of serializers dont result in code changes to the RequestHandler or TmdbEasy classes. |
The data is being returned from the request but not deserialized into the
AlternativeTitlesClass
.Reproduce with tvId = 1399.
Where: TelevisionApiTest -> GetAlternativeTitlesAsync_ValidId_ReturnsValidResult
The text was updated successfully, but these errors were encountered: