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

Does not allow serialization for purposes of Creating Resources #2180

Closed
xn opened this issue Aug 29, 2017 · 1 comment
Closed

Does not allow serialization for purposes of Creating Resources #2180

xn opened this issue Aug 29, 2017 · 1 comment

Comments

@xn
Copy link
Contributor

xn commented Aug 29, 2017

Expected behavior vs actual behavior

I expect to be able to serialize an object without an id for the purpose creating a resource.
Current behavior returns: {data: null}

Steps to reproduce

let(:user_attributes) { FactoryGirl.build(:user) }
post "/v1/users", params: ActiveModelSerializers::Adapter::JsonApi.new(UserSerializer.new(user_attributes)).serializable_hash

Environment

ActiveModelSerializers Version (commit ref if not on tag):
Everything south of 73eae19b3d0b8a3c03fda566a208eeee6720beed

Additonal helpful information

(e.g., Gemfile.lock, configurations, PR containing a failing test, git bisect results)

From the spec:
Creating Resources
A resource can be created by sending a POST request to a URL that represents a collection of resources. The request MUST include a single resource object as primary data. The resource object MUST contain at least a type member.
This is implying that the resource object MAY contain an id, not MUST.

Also here:
#2132

@bf4
Copy link
Member

bf4 commented Nov 2, 2017

Fixed by #2216

@bf4 bf4 closed this as completed Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants