API Generators?

Feels like I’ve been writing a lot of API’s lately. Sometimes it’s a small API and I can get away with a simple Sinatra app, other times it’s a full-blown Rails application and there’s an API component for data manipulation. Regardless, I feel like there ought to be better ways to write API’s!

I looked at Grape today and am genuinely intrigued but I feel like we could go one step further.

Ideally I’d love to define an API using a definition language of sorts, maybe even a Ruby DSL. Running that definition through a generator would generate me an application I could deploy and start testing immediately. I realize Rails essential does this with their generators but it includes too many features I simply don’t need. I don’t want ViewHelpers. I don’t want to manage routes.rb. I don’t need migrations. I just need a JSON interface to the backend.

There are tools that are similar to this for generating RPC code; is there a Ruby equivalent to this? Hm. Maybe a good project idea!