jsonapi-converter icon indicating copy to clipboard operation
jsonapi-converter copied to clipboard

ReadDocumentCollection without Id attribute returns a collection of the same object instance

Open jeffcjames opened this issue 5 years ago • 1 comments

We are implementing a batch POST api to create a collection of objects in s single request. The ids will be generated on the server. We have configured ResourceConverter.disableDeserializationOption(DeserializationFeature.REQUIRE_RESOURCE_ID)

For each element in the json array, the ResourceConverter returns the same object instance. Looks like it is caching the deserialized objects in a temporary cache, using a concatenation of the type value and id as the cache key. Since our ids are null, it uses just the type value as the cache key. Before deserializing each object, it checks the cache and finds the same object every time.

jeffcjames avatar Nov 01 '19 12:11 jeffcjames

@jeffcjames this is indeed how caching is implemented at the moment. Will take a look as soon as i can.

jasminb avatar Nov 04 '19 22:11 jasminb

This can be solved by using local identifier functionality.

jasminb avatar Jul 31 '24 20:07 jasminb