-
Notifications
You must be signed in to change notification settings - Fork 474
Closed
Labels
Milestone
Description
Hi kindof new to this whole HATEOS thing, but I have gotten some suff working. I'm having a very weird issue related to CurieProvider
I have added the CurieProvider in to my application and it works quite well the weird part is now I'm getting two _links
In my API here is an example response
{
"_embedded": {
"bp:channelList": [
{
"name": "general",
"subscription": "/channel/general",
"_links": {
"self": {
"href": "https://api.turkuforge.fi/channel/general"
}
}
},
{
"name": "random",
"subscription": "/channel/random",
"_links": {
"self": {
"href": "https://api.turkuforge.fi/channel/random"
}
}
}
]
},
"_links": {
"curies": [
{
"href": "https://docs.turkuforge.fi/{#rel}",
"name": "bp",
"templated": true
}
]
},
"_links": {
"bp:sockjs-endpoint": {
"href": "https://api.turkuforge.fi/connect"
},
"self": {
"href": "https://api.turkuforge.fi"
},
"curies": [
{
"href": "https://docs.turkuforge.fi/{#rel}",
"name": "bp",
"templated": true
}
]
}
}
live API can be found here and all the code can be found here https://github.com/TurkuForge/baby-project-server
I have been digging in to the issue and it seems that when I do this (can be found on line 43 in RootApiController)
val model = HalModelBuilder.halModel()
getChannels().forEach {
val link = linkTo<ChannelController> { message(it, null) }
val channel = Channel(it, link.toUriComponentsBuilder().build().path)
channel.add(link.withSelfRel())
model.embed(channel)
}
it also adds the second link. I'm not sure why this happens, but its very easaly reproducable since it happens no matter what I do