Closed franzliedke closed 6 years ago
I did extract the duplicate code now; with the indifferent_access stuff in place it is important for the two to stay in sync.
Though maybe this code actually belongs in the Json
transformer? :thinking:
Half-and-half, I think. Traversing the returned hash / array and wrapping it in Resource
objects is generic - interpreting _url
as links is probably JSON-specific.
@jgraichen Is there anything I can do to finish this up?
@jgraichen Could we merge this and release it as experimental, private API for now? That way, we could easily use it to figure out whether it positively impacts serialization times in a relevant way on our services...
This is intended to use as a drop-in replacement for JSON. The two encodings support the same datatypes, thus HTTP's content negotiation can be used to tell a server to deliver a Msgpack response (if it is capable to do so). Fully transparent to the API consumer, this can reduce the HTTP payload by 50 percent in some cases.
Example HTTP Request:
If the server supports msgpack, it will deliver that serialization; if it does not, it will fall back to JSON. Restify will be able to handle both.
Spec: https://msgpack.org/ Library: https://github.com/msgpack/msgpack-ruby