You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library does not appear to match the hal spec in regards to doing post and put operations.
The examples shown from Spring indicate that the server returns a Resource, but the client is expected to post back the embedded object, and not the Resource. When using this framework and calling a method on a service such as update, it sends back the Resource to the post method, which does not appear to match the specification that Spring is promoting.
example: GET returns PlayerResource to client POST client is to return an instance of Player, not PlayerResource
public ResponseEntity < PersonResource > post(@RequestBody final Person personFromRequest) { final Person person = new Person(personFromRequest); personRepository.save(person); final URI uri = MvcUriComponentsBuilder.fromController(getClass()).path("/{id}").buildAndExpand(person.getId()).toUri(); return ResponseEntity.created(uri).body(new PersonResource(person)); }
This library does not appear to match the hal spec in regards to doing post and put operations.
The examples shown from Spring indicate that the server returns a Resource, but the client is expected to post back the embedded object, and not the Resource. When using this framework and calling a method on a service such as update, it sends back the Resource to the post method, which does not appear to match the specification that Spring is promoting.
example:
GET returns PlayerResource to client
POST client is to return an instance of Player, not PlayerResource
public ResponseEntity < PersonResource > post(@RequestBody final Person personFromRequest) { final Person person = new Person(personFromRequest); personRepository.save(person); final URI uri = MvcUriComponentsBuilder.fromController(getClass()).path("/{id}").buildAndExpand(person.getId()).toUri(); return ResponseEntity.created(uri).body(new PersonResource(person)); }
https://dzone.com/articles/applying-hateoas-to-a-rest-api-with-spring-boot
The text was updated successfully, but these errors were encountered: