Closed G4br131 closed 1 year ago
sorry, but this goes beyond the planned capabilities. Currently, only one level of indirection (when a data resource has a relationship) will be resolved. I am not sure if I will implement this. Give me a bit of time to evaluate...
I think I could fix this, please check release 2.0.3.
Hi, we have a json file (see the code below) where the entity "orders" has a relationship (to one) with an entity "customers" and this one has a relationship (to many) with the entity "addresses". We want to parse the json file into the java bean entities whose code is below. The "relationships" attribute of "customers" is inside the "customers" entity which is placed in the "included" section. We can't achieve the "addresses" collection to auto-populate. Looking at the "JsonApiEntityModelDeserializer" class in the "createRelationship" method, this one does not iterate over the JsonApiDocument to find the "relationships" attribute that belongs to the var "typeArgument" passed and so don't included in the var "entry" to create an EntityModel. Also, when the "createRelationship" method call to "convertoToResource" always passes the var "wrapInEntityModel" to false.
Are we trying to do something that is not provided for in the original functionality of the library, or do we need to do something else to map the relationship "addresses" automatically?
I hope I have explained.
Thanks for your time.
json file
java beans entities
rest call
ResponseEntity<PagedModel<EntityModel<Orders>>> response = restTemplate.exchange(...)