rocket_pants
rocket_pants copied to clipboard
RocketPants 2.x Planning
The "What"
This issue hopefully will help solicit and facilitate a discussion around any proposed changes being incorporated into the 2.x release.
The "Why"
While working with rocket_pants I noticed the lack of support for some semi-standardized (well nothing in API land is truly standard) like content-type
based routing and hypermedia-based pagination to name a few. Out of this I released the rocket_shorts
gem (see jsmestad/rocket_shorts) that provided this varied functionality through a series of shims and overrides.
After releasing it, I solicited @sutto for some feedback on the direction, which quickly turned into proposition to merge that work into "the next major version of rocket_pants"
The "Where"
Drafted Proposal: 2.0 Planning
@Sutto added 3 items to the planning document. Look forward to your feedback.
@jsmestad sweet - will take a look this afternoon (also, Have twitter disabled this week so can't reply there).
Could I also suggest referring to http://www.slideshare.net/stormpath/rest-jsonapis for some ideas.
Particularly surrounding hypermedia linking on instances, collections, and meta (pagination, etc).
Other ideas: _expand= param to expand response nodes.
Is there a timeline for v2? I've been researching options for my new Rails based API and think RocketPants is the final choice, so will be in a position to contribute.
Awesome, thanks!
There isn't a timeline at the moment, but I'm aiming to work on it a bit over the christmas break.
WRT to expand, I'd considered it - the biggest issue with that is it's actually incredibly complex to implement efficiently, so it's the sort of thing I'd prefer to do from a gem instead.
On 14/12/2012, at 3:33 AM, Adam Burmister [email protected] wrote:
Could I also suggest referring to http://www.slideshare.net/stormpath/rest-jsonapis for some ideas.
Particularly surrounding hypermedia linking on instances, collections, and meta (pagination, etc).
Other ideas: _expand= param to expand response nodes.
Is there a timeline for v2? I've been researching options for my new Rails based API and think RocketPants is the final choice, so will be in a position to contribute.
— Reply to this email directly or view it on GitHub.
One thing I ran into that I was surprised wasn't covered in rocketpants 1.0 was CORS (Cross-Origin Resource Sharing) support, for example, here's what i had to add to my application_controller to have an API that was accessible from a backbone.js app i'm working on:
before_filter :cor
def cor
headers["Access-Control-Allow-Origin"] = "*"
headers["Access-Control-Allow-Methods"] = %w{GET POST PUT DELETE}.join(",")
headers["Access-Control-Allow-Headers"] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token Authorization}.join(",")
head(:ok) if request.request_method == "OPTIONS"
end
Obviously this is pretty permissive, and the Allow-Origin value should be configurable - but responding to an OPTIONS request seems like a good addition to me.
@Sutto what are your thoughts on basing rocket_pants off of rails_api
ActionController::API. I am spiking on this was we speak and wanted to get your feedback. One thing I would also like to see is a bit easier to configure what "ActiveModelSerializer" to call. I have begun versioning my serializers is why I bring it up.
@jsmestad awesome, I like that idea - I haven't had any time at all to work on stuff for a while, so eager to see what you come up with!
@jsmestad how'd your spike going? I've got some time set aside to work on RocketPants 2.0 right now and figured I'd check in before going ahead :)
@Sutto I will put together a gist of where I made it to. The issue I ran into was trying to make RocketPants use the Responder stuff built into Rails instead of just replacing all of it with a single renderer (like it is now)
Here is a gist. Ignore the name as I just renamed it to Tradesman to avoid conflict with an existing RocketPants install.
https://gist.github.com/jsmestad/8029732
Keep in mind rolled into this is changing versioning to use Accept headers again (just like my rocket_shorts fork). The only thing NOT working is getting the serializer_hash to output in the format of:
{
account: {
id: 1,
name: "Company LLC"
}
}
when calling respond_with @account
and
{
accounts: [{
id: 1,
name: "Company LLC"
}]
}
when calling respond_with @accounts
. Right now it just outputs with no root value which isnt consistent with what AM::Serializers look for.
It should be easy I just ran out of time. I also do versioning via different ActiveModelSerializers rather than other methods. Let me know if you have any feedback or want me to package something up.
Most popular and annoying question: "When?"
I am about to consider using Rocket Pants for existing API. I just read that 2.0 is in the works and wondered if I should wait out a bit until 2.0 comes out... or proceed with 1.0. Please advise.
I'd honestly go with 1.0 for the moment - My goal is going to be to make the transition from 1.0 to 2.0 super easy (read: minimal changes, a built in compatibility layer) - but as you've seen this has dragged on a bit. I'm again spending some time working on it, but I've not been able to historically prioritise this pretty well - so I can't give a hard date on 2.0
Thanks for the prompt response! I'll go ahead and work with 1.0, thanks.
Eagerly waiting for the 2.0 release - how is that going?
Order us around @Sutto, maybe we can help :)
Eagerly waiting for the 2.0 release... has that been dropped?
To be brutally honest - It's not been dropped, but I've definitely dropped the ball. All of my time has been very, very focused on my day job (http://gyde.tv) so I've had zero time to work on it. I still want to see 2.0 done (and have a good idea of what needs to be done) - but I've been distracted by work that I haven't been able to get it done - or organising stuff for people to do.
I still want to see 2.0 - I use rocket pants dailly, but we're on an older rails 3.2 app / nothing new has been needed that has given me the excuse to work on it... yet.