infinum/kotlin-jsonapix

Nullable primary data

Javernaut opened this issue · 1 comments

Hello.

Started using this library and faced an issue.

According to the jsonapi standard:

Primary data MUST be either:

a single resource object, a single resource identifier object, or null, for requests that target single resources

And here I want to emphasize 'null'. Exactly for the 'Primary data'. Now if the library receives

{
   "data": null
}

the parsing will crash with the error:

Input must be either JSON object or array with the key type defined.

So the library doesn't handle the case when the primary data is expected to be nullable. Could you please add the support for such a case?

Hi @Javernaut and thanks for your report.
You are right and we will look into this as soon as possible. You can expect this being fixed in the stable release.