Skip to content

Support for Hypermedia Links #690

@Mcklmo

Description

@Mcklmo

It would be useful to be able to link operations to another. Hypermedia links can link endpoints that are commonly used as follow-up to the current endpoint. The links could be defined on operation creation and be added to the API response automatically.

Example response to GET /users/1

{
  "id": 1,
  "name": "John Doe",
  "email": "john@example.com",
  "_links": {
    "self": {
      "href": "https://api.example.com/users/1"
    },
    "update": {
      "href": "https://api.example.com/users/1",
      "method": "PUT"
    },
    "delete": {
      "href": "https://api.example.com/users/1",
      "method": "DELETE"
    }
  }
}

This could, for example, be achieved by adding a parameter to the Operation struct that is called "HypermediaLinks" that takes a string slice of operation ids. On the api creation, it should panic if a linked operation is not found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions