Skip to content

Instantly share code, notes, and snippets.

View dgeb's full-sized avatar

Dan Gebhardt dgeb

View GitHub Profile
@dgeb
dgeb / json-api-recommendations.md
Last active December 26, 2015 18:49
Recommendations for JSON API

Recommendations for JSON API

I'm planning a series of pull requests for JSON API, many of which are related to issues already raised on Github. I've summarized them here to emphasize common themes:

  • Center requests and responses upon primary resources and reference other resources relatively.
  • By default, make as few assumptions as possible about what the client wants.
  • Allow for a number of degrees of flexibility, all of which are optional, so that the client can customize the response.
  • Provide sufficient recommendations for common API design patterns to inform default implementations.

I touched on a lot of these topics in my talk "Building Ambitious APIs with Ruby" at the Burlington Ruby Conference this summer: video + slides

@dgeb
dgeb / gist:4139842
Created November 24, 2012 14:14
hasManyEmbedded shim for ember-data
// This is a rather ugly shim that replaces the hasMany(..., {embedded: true})
// functionality that's been removed from ember-data. It is for read-only data.
// Embedded data support should eventually be added back into ember-data as an
// adapter concern.
(function() {
var get = Ember.get, set = Ember.set;
var hasEmbeddedAssociation = function(type, options) {
options = options || {};