Mathbl
01/17/2018, 2:42 PMConversation
and it also contains a list of ConversationMembers
. The thing is, my ConversationMember model has a conversationId
property, that is declared as not null -> In the backend, it doesn’t make sense for a ConversationMember
to have a null conversationId
.
But the thing is, the API doesn’t always send me every fields serialized (it avoids serializing useless fields depending on the situation). So I have this place where I get the Conversation
(containing a list of conversationMembers
) from the backend, but the field conversationId
is not present at this place for the conversationMembers
. So when I try to pass this object to the activity and start it, it throws a java.lang.RuntimeException: Unable to start activity java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter conversationId
How do you deal with that use case? I don’t want to mark this field as nullable, cause at the base it doesn’t make sense, but in the context of api responses with fields restricted to the minimum, the property that I mark as not null could end up being null (not present) in some context.menegatti
01/17/2018, 2:49 PMid
is so relevant, why would it be omitted?Mathbl
01/17/2018, 2:54 PMmenegatti
01/17/2018, 3:07 PMMathbl
01/17/2018, 3:09 PMMessage
model, with like 4 foreign keys, and that in a context, the api just return me a Message
with just the field “id” and “content” cause that’s just what is needed at that place, then the same problem happens again.menegatti
01/17/2018, 3:09 PMMathbl
01/17/2018, 3:09 PMmenegatti
01/17/2018, 3:12 PMMathbl
01/17/2018, 3:18 PMMax Russek
01/18/2018, 1:20 AMPartial<T>
in particular and mapped types in general (https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-1.html).rkeazor
01/18/2018, 9:09 AM