Open spring-projects-issues opened 8 years ago
Oliver Drotbohm commented
I'll have that added to the docs. In the mean time, here are the tricks:
CurieProvider
like shown here. CurieProvider
is documented in detail here.rest-messages.properties
using keys like shown hereChristian Bongiorno commented
Ah, you changed this as I was updating it. :)
Oliver Drotbohm commented
There's no explicit handling of those properties as the Resource
infrastructure, Link
etc. is currently media type agnostic and thus doesn't know anything about any HAL-specific properties. The addition of the title is purely done on rendering time (in the HAL specific Jackson module), translating the link relation into a human readable text by using a resource bundle with a predefined key structure. See this commit for details
Christian Bongiorno commented
Ok, fair enough. I see what's going on. But, this approach isn't really keeping inline with having the documentation hooked into the code. There are now 3 seperate things to manage:
1) Repository 2) Documentation for said repo 3) Properties file for getting the title and name (that just happens to have properties that line up with the repo name).
On the Repository interface annotation there is already:
@RepositoryRestResource
(collectionResourceRel = "drivers", path = "drivers",itemResourceDescription = @Description
("Foo") )
path and resourceRel are both exposed on the UI as part of the resource but description is not. Exposing @Description
as documentation seems ideal. Is there are reason to not do this?
Based on your previous links I can do this myself with some work.
Christian Bongiorno commented
Any plans to make this more seemless?
I implemented less-than-ideal means of discovering these details
Christian Bongiorno opened DATAREST-800 and commented
I am using spring-data-rest + hal browser by importing the dependency.
It seems to work well enough but there doesn't seem to ba a way to provide details to:
"title | name/index | docs"
In the links section of the browser. I assume these can be discovered resources but quite a bit of sniffing around isn't finding it
Having spent more time on this I am flagging it as a bug because the the controller used to provide the HAL link data doesn't even produce what is needed:
I am looking at RepositoryController.listRepositories() and following through this code and there is no property at all being exposed for "title" or "name" or "docs". I imagine "Docs" could be exposed as a org.springframework.data.rest.core.annotation.Description on the repository.
See: org.springframework.hateoas.ResourceSupport
Maybe it's not a bug? Maybe it's a feature request. I see your name on the code so I will let you decide
Affects: 2.4.2 (Gosling SR2)
Attachments:
Issue Links: