Using Spring Boot 2 with Spring Data Rest.
Given the following entity tree where all classes have an exposed repository (required):
abstract class Fruit;
class Apple extends Fruit;
class Lemon extends Fruit;
Calling the abstract collection resource /fruits returns Fruit objects each on its key named after the concretes classes names:
{
_embedded: {
apples: [0: , 1: ..],
lemons: [0: , 1: ..]
}
}
I would like for the abstract collection only to have fruits merged in a key named after the abstract class name:
{
_embedded: {
fruits: [0: , 1: ..],
}
}
It works only if concrete classes repositories are not exposed. I need theses concretes class resources as well.
It tried to play with a RelProvider class for Fruit abstract class, but it changes the key name for concrete collection resources as well which i don't want to:
GET /apples:
{
_embedded: {
fruits: [0: , 1: ..],
}
}
Here's what i want:
GET /fruits:
{
_embedded: {
fruits: [0: , 1: ..],
}
}
GET /apples:
{
_embedded: {
apples: [0: , 1: ..],
}
}
GET /lemons:
{
_embedded: {
lemons: [0: , 1: ..],
}
}