toedter / spring-hateoas-jsonapi

A JSON:API media type implementation for Spring HATEOAS
Apache License 2.0
106 stars 15 forks source link

Non-functional links in demo #76

Closed paulharkink closed 1 year ago

paulharkink commented 1 year ago

In the bundled example application, some of the generated links are invalid. For example the directors link

"links": {
        "self": "http://localhost:8080/api/directors/2",
        "directors": "http://localhost:8080/api/directors{?page[number],page[size]}"
      }

seems to include some un-parsed TemplatedVariables; the curly braces are left intact, which is not valid. In the MovieModeAssembler, it looks like some manual string operations are done to get rid of the opening curly brace; I think it would be better if linkTo would generate a usable link in the first place.

Another example of a non-functioning link is the self link of movie relations:

"relationships": {
        "directors": {
          "data": [
            {
              "id": "1",
              "type": "directors"
            }
          ],
          "links": {
            "self": "http://localhost:8080/api/movies/1/relationships/directors",
            "related": "http://localhost:8080/api/movies/1/directors"
          }
        }

which points to an endpoint that does not exist (/movies/{id}/relationships/directors instead of /movies/{id}/directors

toedter commented 1 year ago

thx for reporting this.

The directors link can be templated, this seems to be fine to me. The relationships are not implemented yet, but I will add an implementation soon. I will keep this issue open until then.