Description
Description
Our API uses Spring HATEOAS (short explanation: https://en.wikipedia.org/wiki/HATEOAS). So a typical API response body might look like this:
{
"account": {
"account_number": 12345,
"balance": {
"currency": "usd",
"value": 100.00
},
"_links": {
"deposits": {
"href": "https://myhost/accounts/12345/deposits"
},
"withdrawals": {
"href": "https://myhost/accounts/12345/withdrawals"
},
"transfers": {
"href": "https://myhost/accounts/12345/transfers"
},
"close-requests": {
"href": "https://myhost/accounts/12345/close-requests"
},
}
}
}
Note the added _links
at the end of the response body. This contains several valid links (URLs) to other endpoints. These endpoints normally use Path Parameters, but are already fully resolved here.
If we now want to use Hey API, we run into the problem that we already have a fully valid link, but there is no way to use it in the generated code. We would have to somehow parse our valid URL, extract the path parameters and then pass them to the generated functions with the path
props. This is really cumbersome and involves introducing parsing that could fall apart with any change to the API.
Is there any way to add support for HATEOAS so that we can use our links directly? A cheap solution would be to support passing of a URL to the generated functions, which as far as I can see has already been requested: #452.