plexus / yaks

Ruby library for building hypermedia APIs
http://rubygems.org/gems/yaks
MIT License
236 stars 26 forks source link

Two way conversion #35

Closed plexus closed 9 years ago

plexus commented 10 years ago

Opening this for feedback. I'd like to make a push on two-way conversion. The litmus test will be that a format can round-tip read+generate the JSON used in the acceptance tests.

The latest commit adds some sugar and plumbing to given a Yaks::Config (i.e. the result of Yaks.new) so you can do yaks.read(json_string) and get a Yaks::Resource. The pipeline concept that Yaks is built on has been reified in Yaks::Pipeline.

So far there's a reader for HAL. I'd like to take this opportunity to improve format support in general. The mapper DSL is, at least for the features that are supported now, more or less stable, so this is a good time. JSON-API needs looking at because the spec has changed since it was implemented. I'd like to also add Siren since it has a clean representation of forms that uses individual field representations, just like we currently support.