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

Add docs for deserialization. #1431

Merged
merged 2 commits into from
Mar 17, 2016

Conversation

beauby
Copy link
Contributor

@beauby beauby commented Jan 13, 2016

Ref #1248

end

def create_params
ActiveModelSerializers::Deserialization.jsonapi_parse(params, only: [:title, :content, :author])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you include an example request that this would apply to? e.g.

POST /posts HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{ 
  "data": {
  // whatever
  }
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, that would be great!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@beauby , seeing the data before hand would help understand how much Deserialization is helping out :-)

once it's explained that both fields AND relationships can be passed in here, I think this'll be ready for merge :-)

@joaomdmoura
Copy link
Member

Would be nice to show the available options as well, like polymorphic

@remear
Copy link
Member

remear commented Mar 15, 2016

What remains to be done on this? Is anyone interested in wrapping this up?

@NullVoxPopuli
Copy link
Contributor

I think it would be great to also see an example of how to deserialize relationship data as well.

@beauby
Copy link
Contributor Author

beauby commented Mar 17, 2016

@NullVoxPopuli It is already in there: https://github.com/rails-api/active_model_serializers/pull/1431/files#diff-49eb68fae321c722d2943d2572f0bf5bR27

@NullVoxPopuli
Copy link
Contributor

oh, it just figures out that one of the symbols is a relationship? that's pretty neat. :-)

@beauby
Copy link
Contributor Author

beauby commented Mar 17, 2016

Examples in here https://github.com/rails-api/active_model_serializers/blob/master/lib/active_model_serializers/adapter/json_api/deserialization.rb
Not much time to update this PR. Feel free to improve it as you see fit!

@NullVoxPopuli
Copy link
Contributor

on it! :-)

@NullVoxPopuli
Copy link
Contributor

Added the examples from the code :-)

@beauby
Copy link
Contributor Author

beauby commented Mar 17, 2016

LGTM 👍 Thanks @NullVoxPopuli

NullVoxPopuli added a commit that referenced this pull request Mar 17, 2016
@NullVoxPopuli NullVoxPopuli merged commit 88d4fe5 into rails-api:master Mar 17, 2016
@beauby beauby deleted the deserialization-docs branch April 22, 2016 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants