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

Inconsistent pluralization when using bidirectional @OneToMany [DATAREST-1131]

Open
#1,492 1 comment 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

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

Description

Ewout Van Gossum opened DATAREST-1131 and commented

I am currently developing using Spring Data REST and things are going swimmingly apart from one thing. The plural nouns don't match the language of my API.

I have an Entity called Test that has a bidirectional @OneToMany relationship (with Resultaat) exposed via Data REST. In my language the plural of test is testen, and of resultaat is resultaten. The "TestRepository" is annotated with:

@RepositoryRestResource(collectionResourceRel = "testen", path = "testen")

And when I retrieve "testen" everything works fine. Also the relationship uses the correct plural (based on the name of the property that contains the "resultaten"). So the URI /testen/{id}/resultaten/{id} works. However the self links of Resultaat show "resultaats" in the URI which is the wrong plural.

If I try to define a RepositoryRestResource for Resultaat, the resultaten are mapped correctly, but the api changes the path of "testen" back to "tests" which is a bug in my opinion.

I think it would be handy to solve this issue via an annotation on the entities, that can override the default pluralization.

I can provide an example project of this later in this week if required.


No further details from DATAREST-1131

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.