api2go
api2go copied to clipboard
Add self link to top level links object
Currently, the top level links
object is only used for pagination. Jsonapi spec says that it MAY always be used and then contains the field self
with the URL of the current request.
see here: http://jsonapi.org/format/#document-links
When Fetching a Relationship, we do include a top level links object with self
and related
urls. See #83
Since it's optional, this ticket has a low priority.
http://jsonapi.org/format/#document-top-level
Hey guys. I am interested in helping out with solving this issue since i want to get more into open source and it was the first thing i noticed missing from the example i tried out. @wwwdata comment back in Apr 14, 2015 might be a little outdated - the spec for jsonapi.org at http://jsonapi.org/format/1.1/#fetching-resources states that
Fetching Resources
A server MUST support fetching resource data for every URL provided as:
a self link as part of the top-level links object a self link as part of a resource-level links object a related link as part of a relationship-level links object
What is the current plan regarding the version of jsonapi, are you going for 1.0 or a shot at 1.1? and do you guys think this is a good issue to solve for a beginner? My plan is to help you guys finish the 1.0 milestone, but the other 2 issues have some discussions that confuse me a bit.
I think because 1.1 is still in development we should do the 1.0 spec now. But for this feature they are the same right? I just quickly looked at the documentation and you should always include a links
object with a self
in it. Which in that case is the current request url.
So it would be super awesome if you want to start out implementing this.
I don't know what needs to be done for it right know, would also have to read and check the code. It should definitely be possible to do this manually right now by implementing the LinksResponder
interface in the CRUD actions.
// The LinksResponder interface may be used when the response object is able to return
// a set of links for the top-level response object.
type LinksResponder interface {
Responder
Links(*http.Request, string) jsonapi.Links
}
Alright cool. I have to read all of the code first obviously, but i will create a PR and reference this issue as soon as i start comitting code for it.