Description
The toEntity
and toEntityList
methods throw FieldAccessException
if the field is null
, with the idea that a field either has a value, or otherwise is set to null
in case of a field error. This is true generally, but a field could also be null
without any errors, e.g. if it is optional.
For 1.1 we'll refine toEntity
in ClientResponseField
to return null
if the field value is null, but response is neither invalid, nor there are field errors. Likewise toEntityList
to return an empty list in the same scenario.
Note that a similar change was made for GraphQlClient#retrieve
some time ago, in 3c30376, so this would align the two. The retrieve
method actually delegates to ClientResponseField#toEntity
internally but needs to perform a more strict check for field errors even when a field value is present, because with retrieve
the response is not used directly, and such errors would be missed otherwise.