resthub / resthub-backbone-stack

RESThub Backbone.js stack
http://resthub.org/docs/backbone/
Other
56 stars 26 forks source link

JSON - Hypermedia or references support? #87

Open bclozel opened 11 years ago

bclozel commented 11 years ago

See issue https://github.com/resthub/resthub-spring-stack/issues/45 for the server part.

How should we consider support for:

We should consider only one of those options.

JSON reference

On the client side, several libs achieved this:

There are problems on the server side: Jackson doesn't support the json-ref syntax "$ref" and only relies on having typed objects on both client/server sides (see ObjectIdentity).

There are also problems on the client side; javascript client libs duplicate data, i.e. they expand the object graph with their values. This can be problematic when updating data on the client side.

Hypermedia

We could consider HAL and/or json-ld formats and integrate those on the client side for lazy-loading and metadata.

We could integrate those within backbone using:

Of course, I'm all for Hypermedia!

manosbatsis commented 11 years ago

Regarding references, why not use Jackson's @JsonIdentityInfo[1]? It just works as far as the spring stack goes, but needs support on the backbone stack side. Perhaps something as simple as an identity map [2]. I'd surely vote for this as a core resthub feature.

[1] http://wiki.fasterxml.com/JacksonFeatureObjectIdentity [2] http://blog.shinetech.com/2012/12/24/an-identity-map-for-backbone-js/