blaze-persistence icon indicating copy to clipboard operation
blaze-persistence copied to clipboard

Support for HATEOAS RepresentationModel link relation naming

Open mj-p opened this issue 1 year ago • 2 comments

Hello, is there support for annotations to be added to the generated EntityView classes? In my case I would like to use the HATEOAS models wrapping my EntityViews like this:

PagedModel<EntityModel<GroupView>> findAll(Pageable pageable, PagedResourcesAssembler<GroupView> assembler) {
  return assembler.toModel(groupViewRepository.findAll(pageable));
}

The only "problem" I have now is the HAL representation uses the proxy class name like:

{
  "_embedded": {
    "groupView_$$_javassist_entityview_s": [...]
  },
  // links and page stuff
}

This is where I would like to use @Relation(collectionRelation = "groups") to overrule the naming instead of messing with RelProviders or MessageConverters like described here: https://docs.spring.io/spring-hateoas/docs/current/reference/html/#server.rel-provider

Maybe I am missing something obvious, help appreciated.

mj-p avatar Jan 26 '24 20:01 mj-p

Hi, I'm no expert in Spring HATEOAS, but maybe @ask4gilles can help here?

beikov avatar Jan 29 '24 10:01 beikov

Despite this being a rather specific case with limited options provided by HATEOAS I guess it feeds into this issue (#1044)? Being able to have annotations on the generated implementation classes of your EntityViews would be a nice feature.

mj-p avatar Jan 29 '24 13:01 mj-p