spring-projects / spring-projects/spring-data-rest

Extend generated URLs for a given Domain Object [DATAREST-339]

Open
#721 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

in: repository type: enhancement
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Benjamin M opened DATAREST-339 and commented

Following situation with 2 Maven modules:
Module 1 has an User entity
Module 2 has a MessageInbox entity

The MessageInbox knows the User (because of Maven dependency management), but the User doesn't know the MessageInbox.

I'd like to expose following URL without modifying the User entity:
/users/\{userId\}/messageInbox
Of course this is possible via ResourceProcessor, but it's not nice, because I have to take care of the path in 2 locations.

It would be much better if I could do the following:

@RepositoryRestController
@ExposesResourceExtensionFor(User.class)
public UserMessageInboxController { ... }

So it would automatically set @RequestMapping("/users"), because my UserRepository says that it's path="users".

EDIT: And of course it should act as the ResourceProcessor and add the \@RequestMapping s from this controller to the User resource


Affects: 2.1 GA (Dijkstra)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.