Null value attributes on Apprentice 1 items

Regarding the 2.X API docs
A lot of the attributes in the resources are documented as returning null or value. For example, resurrected_at can be null or a date. In the actual response data I’m finding that unlocked vocabulary items, for example, can return null for attributes like meaning_correct. I have gone through the lesson, but it’s never come up in a review yet so I’d assume it’s sitting at SRS Apprentice 1.

Even though I’m asking about V2 there, I’m actually debugging the WaniKaniApiSharp project, and it’s hitting the 1.4 API, I think. So I’m also asking why I’m getting null values for these entries. If the API has always behaved like this then it’s more a case of I’m one of the first people to use this C# Api client.

Inner Exception 2:
JsonSerializationException: Error converting value {null} to type 'System.Int32'. 
Path 'requested_information[1092].user_specific.meaning_correct', line 1, position 507207.
  "level": 20,
  "character": "防止",
  "kana": "ぼうし",
  "meaning": "prevention",
  "user_specific": {
    "srs": "apprentice",
    "srs_numeric": 1,
    "unlocked_date": 1549821672,
    "available_date": 1550019600,
    "burned": false,
    "burned_date": 0,
    "meaning_correct": null,
    "meaning_incorrect": null,
    "meaning_max_streak": null,
    "meaning_current_streak": null,
    "reading_correct": null,
    "reading_incorrect": null,
    "reading_max_streak": null,
    "reading_current_streak": null,
    "meaning_note": null,
    "reading_note": null,
    "user_synonyms": null

The 2.x docs don’t help if you’re dealing with an app that’s still using version 1.4. Looks like WaniKaniApiSharp was last committed to a year ago, which isn’t too bad. You’d have to tag Viet to double check that this has always returned null. Assuming nothing broke in API 1.4, you could always try to submit a pull request fixing this bug in WaniKaniApiSharp. Though I’d really recommend using something (or building something) that utilizes 2.x at this point.


Your feedback is well received. Thanks.
@viet: tagging as suggested

I agree it’s not intuitive to contrast to a different major version of the API, but sometimes it’s damn hard to keep 2.x from leaking into 1.x so I’m just trying to cover the bases.

Yeah - too bad rewriting a the .NET API client for 2.x wouldn’t be a sexy entry into the API contest. Still, I’d consider making a client.

Darin and I took a look.

The case illustrated by tombo should return 0 for all the meaning_ and reading_ fields. It was the case in the past. The reason it is returning null now is due to a refactoring we did a year or two ago and unfortunately we did not catch this problem.

I am going to do a PR to remedy this issue. I’ll let you know when it is live.


Right on. Hopefully someone hasn’t written client side code that expects null there. As in, they wrote it after the bug was introduced or developed a workaround without reporting the bug. :crossed_fingers:

1 Like

Verified as fixed. Thanks!