masvis/angular4-hal

Post and Put operations do not match specification

Opened this issue · 2 comments

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

please more details

do a pull request