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

Includes links inside of linked resources #727

Merged
merged 1 commit into from
Nov 12, 2014

Conversation

kurko
Copy link
Member

@kurko kurko commented Nov 12, 2014

According to
http://jsonapi.org/format/#document-structure-resource-objects,

Resource objects have the same internal structure, regardless of
whether they represent primary or linked resources.

And then
http://jsonapi.org/format/#document-structure-resource-object-attributes,

There are four reserved keys in resource objects:

"id"
"type"
"href"
"links"

This commit includes links inside of linked resources. This way, something like include: "comment.author" won't lose the reference (given comment does not include links).

According to
http://jsonapi.org/format/#document-structure-resource-objects,

> Resource objects have the same internal structure, regardless of
> whether they represent primary or linked resources.

And then
http://jsonapi.org/format/#document-structure-resource-object-attributes,

> There are four reserved keys in resource objects:
>
> "id"
> "type"
> "href"
> "links"

This commits includes `links` inside of linked resources.
if serializers.first
type = serializers.first.object.class.to_s.underscore.pluralize
end
private
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved add_links and add_link to below private.

Copy link
Member

Choose a reason for hiding this comment

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

+1

@kurko
Copy link
Member Author

kurko commented Nov 12, 2014

cc @ggordon @guilleiguaran

@ggordon
Copy link
Contributor

ggordon commented Nov 12, 2014

Nice! +1

@guilleiguaran
Copy link
Member

Looks good 👍

kurko added a commit that referenced this pull request Nov 12, 2014
@kurko kurko merged commit 5038147 into master Nov 12, 2014
@kurko kurko deleted the include-links-in-linked-resources branch November 12, 2014 21:08
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.

None yet

4 participants