Skip to content

Conversation

amcaplan
Copy link
Contributor

Exactly what it says.

For context: The reason this project exists is because none of the listed Ruby implementations allow you to switch request context (e.g. use a different Authorization header) across multiple requests; they all require setting global state. They also tend to assume APIs allow all the usual JSONAPI routes, and many don't (working with e.g. Rails' shallow routes often doesn't seem possible). In my use case, I needed to allow using different API keys on a per-request basis, and some of the routes of this API are, though compliant, somewhat complicated.

Once I had to start from scratch, I ended up building a framework for building Ruby clients that tries to balance between allowing more low-level per-request tweaks, leveraging the power of JSON API filter and includes, using a lot of laziness, but still making most of the complexity optional through semantically parsing the responses and fetching related records as-needed.

I appreciate the beauty of post.authors.map(&:comments), but I was less convinced of the need to use relational algebra to enable includes through Post.includes(author: :comments).find(1) when Post.fetch(url_opts: { id: 1 }, includes: ['author.comments']) works just fine. I get why other people like it, I just thought a simpler solution might be all that's necessary.

That said, the syntax isn't the main goal here; it's more about customization of routes and request details, which weren't provided by any solution I could find.

@dgeb dgeb merged commit b3815fe into json-api:gh-pages Feb 17, 2018
@dgeb
Copy link
Member

dgeb commented Feb 17, 2018

Sounds great - thanks @amcaplan!

joananeves added a commit to joananeves/json-api that referenced this pull request Apr 18, 2018
* json-api-gh-pages: (259 commits)
  jsonapi-realizer is a new server side hander, intended to be a sister to jsonapi-serializers (json-api#1267)
  Added DenaliJS to the Node framework list (json-api#1264)
  Added Vox to iOS implementations (json-api#1262)
  Update scala-jsonapi link (json-api#1263)
  added sarala javascript packages to implementations (json-api#1260)
  Add SimpleJSONAPIClient to Ruby implementations (json-api#1257)
  Removed py-jsonapi (json-api#1258)
  Move fast_jsonapi to it\'s proper place in the ruby server list (json-api#1256)
  Clarify pagination links in relationship object (json-api#1251)
  move safrs to server libraries (json-api#1253)
  Add fast_jsonapi to Ruby Lists (json-api#1252)
  JSON API Playground link added to implementations (json-api#1248)
  Add SAFRS to list (json-api#1250)
  Always return "included" where "include" has been requested (json-api#1236)
  ngx-jsonapi added to implementations (json-api#1228)
  PHP library for JSON API + Doctrine
  add @crnk/angular-ngrx implementation
  Add jsonapi-mock to implementations
  Add raml-json-api to implementations
  Clarify pending async process response json-api#1223
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants