Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An attempt at a Hateoas setup for quarkus

Future todo:

  • Recursively append links to @HalResponse's
  • Automatically add _self
  • Allow tagging entityId in routes
    • Could be done via naming it in the @HalId("postId")
    • Or in the pathparam @PathParam("postId") @HalId int postId

Material

Main goals

  • Create an easily usable API to create HATEOAS HAL geneeration on JAX-RS controllers
  • Allow usage in classes and records
  • Integrate well with Quarkus setups
  • Allow customization of object and route object names

Current progress:

GET http://localhost:8080/posts

HTTP/1.1 200 OK
Content-Type: application/json
content-length: 1279

[
  {
    "id": 1,
    "title": "Post one",
    "content": "Lorem Ipsum",
    "comments": [
      {
        "id": 1,
        "content": "Great video!",
        "sender": 1
      }
    ],
    "links": {
      "add": {
        "href": "posts",
        "rel": "add",
        "type": "POST"
      },
      "list_posts": {
        "href": "posts",
        "rel": "list_posts",
        "type": "GET"
      },
      "update": {
        "href": "posts",
        "rel": "update",
        "type": "PATCH"
      },
      "byId": {
        "href": "posts/1",
        "rel": "byId",
        "type": "GET"
      },
      "delete": {
        "href": "posts/1",
        "rel": "delete",
        "type": "DELETE"
      }
    }
  },
  {
    "id": 2,
    "title": "Post two",
    "content": "Foo bar",
    "comments": [
      {
        "id": 7,
        "content": "Great video!",
        "sender": 1
      },
      {
        "id": 5,
        "content": "Great video! !!!",
        "sender": 2
      },
      {
        "id": 6,
        "content": "Great video dude!",
        "sender": 6
      }
    ],
    "links": {
      "add": {
        "href": "posts",
        "rel": "add",
        "type": "POST"
      },
      "list_posts": {
        "href": "posts",
        "rel": "list_posts",
        "type": "GET"
      },
      "update": {
        "href": "posts",
        "rel": "update",
        "type": "PATCH"
      },
      "byId": {
        "href": "posts/2",
        "rel": "byId",
        "type": "GET"
      },
      "delete": {
        "href": "posts/2",
        "rel": "delete",
        "type": "DELETE"
      }
    }
  },
  {
    "id": 3,
    "title": "Post one",
    "content": "Bazzzz",
    "comments": [
      {
        "id": 2,
        "content": "FOOBAR",
        "sender": 1
      }
    ],
    "links": {
      "add": {
        "href": "posts",
        "rel": "add",
        "type": "POST"
      },
      "list_posts": {
        "href": "posts",
        "rel": "list_posts",
        "type": "GET"
      },
      "update": {
        "href": "posts",
        "rel": "update",
        "type": "PATCH"
      },
      "byId": {
        "href": "posts/3",
        "rel": "byId",
        "type": "GET"
      },
      "delete": {
        "href": "posts/3",
        "rel": "delete",
        "type": "DELETE"
      }
    }
  }
]

About

A HATEOAS tooling set for Quarkus apps

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages