-
Notifications
You must be signed in to change notification settings - Fork 84
Description
Current code
private List<FailoverPolicy> failoverPolicies;
} else if ("failoverPolicies".equals(fieldName)) {
List<FailoverPolicy> failoverPolicies
= reader.readArray(reader1 -> FailoverPolicy.fromJson(reader1));
deserializedDatabaseAccountGetProperties.failoverPolicies = failoverPolicies;
If backend returns null or the property is not included in response, the failoverPolicies would be null.
Should we instead set the failoverPolicies to be empty list, in such case?
PS: I think we don't want to affect serialization. If user does not set the property, we should not send an empty JSON array to backend.
My concern on this, is that the model class generally reflect what service's response payload. (we can and does have convenience API to wrap this and return empty list, but this would be another story)
Service could use "this property not in response" and "this property in response and is []" to signify different scenario (so far, I am not aware of service does this -- but this could just due to my ignorance).
And SDK may not want to override the service payload.
The only safe case is that the property is "required". But this is not true in cosmos-db Swagger.