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

Issue with links behavior [DATAREST-695]

Open
#1,067 0 comments 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

Andrei Kazakou opened DATAREST-695 and commented

When we perform a request to the root URL, we hope to get the working links. As it was for the previous one (2.2.1). But for 'org.springframework.data:spring-data-rest-webmvc:2.4.0.RELEASE' we have the following issue:

We have 3 entities, and the appropriate PagingAndSortingRepository for them.
When we perform a request to the root URL, we receive the following JSON:
{
_links: {
entity5s: {
href: "http://localhost:8080/data/entities/entity5s{?page,size,sort}",
templated: true
},
entity6s: {
href: "http://localhost:8080/data/entities/entity6s{?page,size,sort}",
templated: true
},
entity1s: {
href: "http://localhost:8080/data/entities/entity1s{?page,size,sort}",
templated: true
},
profile: {
href: "http://localhost:8080/data/entities/alps"
}
}
}
When we try to perform any of the links above (e.g. http://localhost:8080/data/entities/entity5s{?page,size,sort} ) we get Status Code:404 Not Found.
But when we delete {?page,size,sort} from the end of URL - it works fine.

For the previous version 'org.springframework.data:spring-data-rest-webmvc:2.2.1.RELEASE' the links can be performed with {?page,size,sort}.

Also we found documentation inconsistency (http://docs.spring.io/spring-data/rest/docs/2.4.0.RELEASE/reference/html/).
"For example, to discover what resources are available at the root of the application, issue an HTTP GET to the root URL:
curl -v http://localhost:8080/

< HTTP/1.1 200 OK
< Content-Type: application/hal+json

{ "_links" : {
"orders" : {
"href" : "http://localhost:8080/orders"
},
"profile" : {
"href" : "http://localhost:8080/api/alps"
}
}
}
"
As you can see, there is no {?page,size,sort} in the end of generated link. But as was showed above, actually, links has{?page,size,sort}.


Affects: 2.4 GA (Gosling)

Attachments:

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.