spring-projects / spring-projects/spring-data-rest
Collection attributes represented as string in schema [DATAREST-580]
@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
Etki opened DATAREST-580 and commented
Hi.
First of all, i want to say that is highly possible that i misunderstood something. I'm new to Java and sometimes i get lost inside source code and specs.
I'm building new application using Spring REST data and @RestResource annotations, and i develop an automatic entity admin dashboard for that application. The point is, whenever i dump entity schema, both *-to-one and *-to-many relationship attribute appear the same - as "string" type of "uri" format. As far as i understand, *-to-many relationships should be represented as "array" type; i haven't fiddled a lot with curl, but it seems that SDR simply rejects passed entity if it contains string representation of link instead of array. As you can see in related URL, passed type doesn't have a chance to be specified as array, because if it receives "uri" format, it is represented as string only. So, to sum up, i believe that following attribute
@ManyToMany
List<X> exes;
Should be represented in schema as
"exes": {
"type": "array",
"format": "uri"
}
While it appears as
"exes": {
"type": "string",
"format": "uri"
}
Affects: 2.3 GA (Fowler)
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.