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

Documentation specifies wrong HTTP method for adding elements to collections [DATAREST-395]

Open
#772 1 comment 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: bug type: documentation
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

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.