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

Chapters in MangaSearchEntry can be null #15

Closed
moiph opened this issue Jun 13, 2020 · 2 comments · Fixed by #16
Closed

Chapters in MangaSearchEntry can be null #15

moiph opened this issue Jun 13, 2020 · 2 comments · Fixed by #16

Comments

@moiph
Copy link
Contributor

moiph commented Jun 13, 2020

Sample request: https://api.jikan.moe/v3/search/manga?q=naruto

...
"results":[{"mal_id":95210,"url":"https:\/\/myanimelist.net\/manga\/95210\/Boruto__Naruto_Next_Generations","title":"Boruto: Naruto Next Generations","image_url":"https:\/\/cdn.myanimelist.net\/images\/manga\/3\/181968.jpg","type":"Manga","volumes":null,"chapters":null,"publishing":true,
...
JikanDotNet.Exceptions.JikanRequestException: Serialization failed.
Inner exception message: Error converting value {null} to type 'System.Int32'. Path 'results[0].chapters', line 1, position 404.
 ---> Newtonsoft.Json.JsonSerializationException: Error converting value {null} to type 'System.Int32'. Path 'results[0].chapters', line 1, position 404.
 ---> System.InvalidCastException: Null object cannot be converted to a value type.
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   --- End of inner exception stack trace ---
@Ervie
Copy link
Owner

Ervie commented Jun 13, 2020

This is kinda weird, chapters and volumes should default themselves to 0 when there is no definite number - this is the result I got when calling endpoint mentioned in the sample. I guess this might be something related to caching changes.

I guess changing this to nullable property (the same as for volumes and episodes in anime search) won't hurt.

@Ervie Ervie closed this as completed in #16 Jun 13, 2020
@Ervie
Copy link
Owner

Ervie commented Jun 13, 2020

Done, it is patched in version 1.4.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants