Looks like as part of #238 there was introduced a new issue. If ApiResource has relationship and a caller requested ?include=some then it will return that object but all attributes in the included object would be null. It happens as that PR filters out properties that aren't in the current ApiResource but in case of Included that code still searches in the current ApiResource.
i updated it and now it creates serializer based on ApiResource from the ResourceGraphNode so it might be different depending on the object. I also added caching in Dictionary as DefaultContractResolver (and our inheritor SourceContractResolver) caches properties that it got from the Type but only as part of that instance so we can't recreate it each time.
i also used regular Dictionary and not ConcurrentDictionary as i'm not sure that this code can be executed in parallel
Also updated one existing unit test to cover that scenario (just to validate that all attributes in the included object are present)
Hi Jouke,
Looks like as part of #238 there was introduced a new issue. If ApiResource has relationship and a caller requested
?include=some
then it will return that object but all attributes in the included object would benull
. It happens as that PR filters out properties that aren't in the currentApiResource
but in case of Included that code still searches in the currentApiResource
.i updated it and now it creates serializer based on
ApiResource
from theResourceGraphNode
so it might be different depending on the object. I also added caching inDictionary
asDefaultContractResolver
(and our inheritorSourceContractResolver
) caches properties that it got from the Type but only as part of that instance so we can't recreate it each time.i also used regular
Dictionary
and notConcurrentDictionary
as i'm not sure that this code can be executed in parallel Also updated one existing unit test to cover that scenario (just to validate that all attributes in the included object are present)Before the fix the output of that test would be