spring-projects / spring-projects/spring-data-rest
Extend generated URLs for a given Domain Object [DATAREST-339]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.