Skip to content
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

ChangeList does not return consistent results #31

Open
tonykaralis opened this issue Aug 3, 2020 · 2 comments
Open

ChangeList does not return consistent results #31

tonykaralis opened this issue Aug 3, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@tonykaralis
Copy link
Owner

When querying the MovieApi for a ChangeList one of the nested properties does not return a consistent value which results in the json deserialization to fail.

List<Change> result = await apiUnderTest.GetChangesAsync(id, "30/05/2019", "20/05/2019", apiKey: _userApiKey);
    public class Change
    {
        public string Key { get; set; }
        public List<Item> Items { get; set; }
    }

    public class Item
    {
        public string Id { get; set; }
        public string Action { get; set; }
        public string Time { get; set; }
        public string Iso_639_1 { get; set; }
        public string Value { get; set; }      // offending properties
        public string Original_value { get; set; }     // offending properties
    }

The Value and Original_value can take the following shape within the raw JSON. There may be more, but these are the ones encountered so far.

"value": {
        "iso_3166_1": "NL",
        "iso_639_1": "",
          "release_date": "2004-08-04",
          "certification": "16",
          "type": 5,
          "note": "DVD"
}

or

"value": {
        "backdrop": {
           "file_path": "/aEdy9BNNdg6qwjyHIbVTflZDFb2.jpg"
         }
    }

or

"value": "Комиксовият герой е с чисто нов, вече с черен костюм, който напълно отгов",
@tonykaralis
Copy link
Owner Author

As a temporary fix so users can at least get some data, I have removed the 2 properties from the class

@PoLaKoSz
Copy link
Contributor

PoLaKoSz commented Aug 6, 2020

Answering the comment from here.

  • If You really don't want to move the HttpClient one level up than, than the TmdbEasyClient could have a method with a GetResponseAsync<TmdbEasyModel>(string query, IChangeListDeserializer deserializer) signature.
  • To solve the "new deserializer-new method" problem, the IChangeListDeserializer interface -and any future one- could inherit from an interface (for ex.: IEndpointDeserializer ) then this interface should be the second argument after the string query

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants