spring-projects / spring-projects/spring-data-rest
Documentation specifies wrong HTTP method for adding elements to collections [DATAREST-395]
@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
Saulo Medeiros de Araujo opened DATAREST-395 and commented
The documentation specifies that one adds elements to collections by performing a POST request to an association resource. Actually, one has to performe a PATCH request. This can be verified by looking to the source code of the RepositoryPropertyReferenceController. More specifically, the method createPropertyReference has the following signature:
@RequestMapping(value = BASE_MAPPING, //
method = { RequestMethod.PATCH, RequestMethod.PUT }, //
consumes = { "application/json", "application/x-spring-data-compact+json", "text/uri-list" })
@ResponseBody
public ResponseEntity<? extends ResourceSupport> createPropertyReference(
final RootResourceInformation resourceInformation, final HttpMethod requestMethod,
final @RequestBody Resources<Object> incoming, @BackendId Serializable id, @PathVariable String property)
throws Exception {
Affects: 2.2 GA (Evans)
Reference URL: http://docs.spring.io/spring-data/rest/docs/2.2.0.RELEASE/reference/html/#repository-resources.association-resource
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.