Skip to content

hateoas.Link is not marked as ignorable  #524

Closed
@Rocks360

Description

@Rocks360

Hello,
I get the following error when I try to consume a api with restTemplate

Sat Dec 10 17:11:23 CET 2016
There was an unexpected error (type=Bad Request, status=400).
Could not read document: Unrecognized field "templated" (class org.springframework.hateoas.Link), not marked as ignorable (one known property: "href"]) at [Source: java.io.PushbackInputStream@7a06aed1; line: 10, column: 25] (through reference chain: org.springframework.hateoas.Resource["_links"]->org.springframework.hateoas.Link["templated"]); nested exception is com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "templated" (class org.springframework.hateoas.Link), not marked as ignorable (one known property: "href"]) at [Source: java.io.PushbackInputStream@7a06aed1; line: 10, column: 25] (through reference chain: org.springframework.hateoas.Resource["_links"]->org.springframework.hateoas.Link["templated"])

I restTemplate request is the following:

ResponseEntity<Resource<Cart>> responseEntity = restTemplate.exchange(cartUrl, HttpMethod.GET, 
null, new ParameterizedTypeReference<Resource<Cart>>() {});

The response of the Rest api is the following:

{
  "creationDate": "2016-12-10T14:30:25.000+0000",
  "totalAmount": 501,
  "_links": {
    "self": {
      "href": "http://localhost:8082/carts/1"
    },
    "cart": {
      "href": "http://localhost:8082/carts/1{?projection}",
      "templated": true
    },
    "checkout": {
      "href": "http://localhost:8083/order"
    },
    "items": {
      "href": "http://localhost:8082/carts/1/items"
    }
  }
}

It already looked in the hateoas.Link class and the Annotation to ignore the "templated" property is already set but not recognized I guess.

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