Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make JSONAPISource/JSONAPISerializer more customizable #81

Closed
MaKleSoft opened this issue Jan 7, 2015 · 3 comments
Closed

Make JSONAPISource/JSONAPISerializer more customizable #81

MaKleSoft opened this issue Jan 7, 2015 · 3 comments

Comments

@MaKleSoft
Copy link

I understand that the JSONAPISource was designed to work with a JSON API compliant data source. However, it would be nice if it was easily customizable to support variations of the spec. Specifically:

  • Allow providing specific resources paths for certain models in the schema
  • Provide a simple hook for making adjustments to serialization/deserialization. The current deserialize method is not very suited to be overwritten since one would need to copy/paste a lot of code. For example, what if instead of {users: [..], ...} I want to parse something like {data: [...], ...}? This should be possible through a simple hook like parseData: response -> response.data.

Perhaps it would make sense to create an intermediate model like AjaxSource or something that covers some of the common ground of remote sources in general but provides more flexibility regarding encoding, serialization etc.

@dgeb
Copy link
Member

dgeb commented Jan 12, 2015

I've had similar issues and have begun to make progress on improving customizability. See the following commits:

  • 83135b2 - Introduce JSONAPISource#resourcePath
  • 163a7ee - Introduce resourceLink and resourceAttr methods to Serializer.

@MaKleSoft
Copy link
Author

Awesome, thanks!

@dgeb
Copy link
Member

dgeb commented Jun 19, 2015

The JSONAPISource / JSONAPISerializer are starting to fill out with a number of methods that can be overridden and customized.

I'm going to close this now, but am open to requests to allow for specific types of customization.

@dgeb dgeb closed this as completed Jun 19, 2015
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

No branches or pull requests

2 participants