Skip to content

Post and Put operations do not match specification #45

@Igneous01

Description

@Igneous01

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions