Skip to content

Include data key when lazy-loaded relationships are included - #10

Merged
kpheasey merged 3 commits into
jsonapi-serializer:devfrom
LaunchPadLab:include-lazy-loaded-relationships
Oct 8, 2019
Merged

Include data key when lazy-loaded relationships are included#10
kpheasey merged 3 commits into
jsonapi-serializer:devfrom
LaunchPadLab:include-lazy-loaded-relationships

Conversation

@dpikt

@dpikt dpikt commented Oct 4, 2019

Copy link
Copy Markdown
Contributor

Resolves Netflix/fast_jsonapi#357

When a relationship is listed under include:, it will add the data key to the record hash, allowing the included relationships to be reconstructed.

end

def record_hash(record, fieldset, params = {})
def record_hash(record, fieldset, includes_list, params = {})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If includes_list doesn't have a default value here, it could be a breaking change.

end

def serialize(record, serialization_params, output_hash)
def serialize(record, included, serialization_params, output_hash)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems like a breaking change. New parameters should generally be appended to the list and included a default.

@jopotts

jopotts commented Oct 7, 2019

Copy link
Copy Markdown
Contributor

@kpheasey I've looked into the possible breaking change issues with the method params on record_hash, relationships_hash and Relationship#serialize, and none seem to be part of the standard public interface. It is possible that a deeply coupled use of the gem might be affected, but I think the fix this change is addressing is worth it. The alternative would be to make the new params non-breaking, but it would make these internal methods ugly. Tricky.

@dpikt Can you look into the conflict in the spec. Thanks.

@kpheasey
kpheasey merged commit 8e23831 into jsonapi-serializer:dev Oct 8, 2019
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.

3 participants