Skip to content

Conversation

@lgebhardt
Copy link
Member

@lgebhardt lgebhardt commented Jan 7, 2021

Also simplify and clarify naming for internal components

All Submissions:

  • I've checked to ensure there aren't other open Pull Requests for the same update/change.
  • I've submitted a ticket for my issue if one did not already exist.
  • My submission passes all tests. (Please run the full test suite locally to cut down on noise from travis failures.)
  • I've used Github auto-closing keywords in the commit message or the description.
  • I've added/updated tests for this change.

New Feature Submissions:

  • I've submitted an issue that describes this feature, and received the go ahead from the maintainers.
  • My submission includes new tests.
  • My submission maintains compliance with JSON:API.

Bug fixes and Changes to Core Features:

  • I've included an explanation of what the changes do and why I'd like you to include them.
  • I've provided test(s) that fails without the change.

Test Plan:

Reviewer Checklist:

  • Maintains compliance with JSON:API
  • Adequate test coverage exists to prevent regressions

This PR primarily reworks the internal components to allow passing a resource, or and array of resources, to the serializer for serialization. This restores a functionality that previously existed in v0.9.x and earlier, but was made very difficult in v0.10.x.

To accomplish this the ResourceFragment is expanded to allow an optional reference to a resource instance. This allows the ResourceTree (renamed from ResourceIdTree) to be constructed from fragments with or without full resources. The ResourceTree now is responsible for loading the included resources instead of the Processor. This allows the serializer to populate the full response (similar to v0.9 and earlier).

Some differences in behavior from v0.9:

  • Resources serialized this way do not walk the tree of included models to resolve the includes
  • Included resources are retrieved using the two staged flow that's used by the processor (ResourceIdentites are plucked and then resources are instantiated using records_for_populate to fill in missing resources in the full set)

@lgebhardt lgebhardt marked this pull request as draft January 8, 2021 16:02
…eding to understand the internal components

Also simplify and clarify naming for internal components
@lgebhardt lgebhardt force-pushed the refactor_for_simple_serialization branch from feff442 to c544a06 Compare January 12, 2021 21:30
@lgebhardt lgebhardt marked this pull request as ready for review January 14, 2021 16:39
@lgebhardt lgebhardt merged commit eb43272 into master Jan 21, 2021
@lgebhardt lgebhardt deleted the refactor_for_simple_serialization branch January 21, 2021 15:55
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.

2 participants