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

Support inclusions of complex object graphs #364

Closed
remmeier opened this issue Mar 12, 2017 · 0 comments
Closed

Support inclusions of complex object graphs #364

remmeier opened this issue Mar 12, 2017 · 0 comments

Comments

@remmeier
Copy link
Contributor

remmeier commented Mar 12, 2017

complex object graphs, e.g. with parents and children and other cyclic structures, are currently not properly supported. An attribute can only be included once, regardless of its position in the object graph. For example, include=parent.parent.children is currently cut off after the first parent. This limiation should be removed.

Note that:
any implementation must make sure that the IncludeLookupSetter does not get trapped in a cycle. So instead of allowing to follow every attribute only once, it must enforce to follow every attribute per resource only once. As a consequence, IncludeLookupSetter must keep track of what he has already done.

Further note that:
we currently have two inclusion mechanisms:

  • GET /tasks/?include[projects]=task&include[tasks]=comments
  • GET /tasks/?include[projects]=task.comments

for cyclic structures they do have different semantics, the former becoming recursive. A feature flag should to be introduced to disable the former and let the application decide whether to use it or not. By default it is enabled to maintain the current behavior.

remmeier added a commit that referenced this issue Mar 12, 2017
- introduced lookup behavior in KatharsisPropreties
- switched abort criteria in IncludeLookupSetter from "attribute
processed" to "attribute for given resource processed". Same attribute
can this way be populated for different resources at different positions
in object graph.
remmeier added a commit that referenced this issue Mar 12, 2017
remmeier added a commit that referenced this issue Mar 14, 2017
- introduced lookup behavior in KatharsisPropreties to switch between
including only paths from the requested (root) type to support arbitrary
inclusions with the include[type] syntax. The former adhering to the
JSON API spec, the later providing a powerful extension and used in
Katharsis already for quite a while (and for this reason staying the
default).
- switched abort criteria in IncludeLookupSetter from "attribute
processed" to "attribute for given resource processed". The same
attribute can this way be populated for different resources at different
positions in object graph. With this complex object graphs will get
properly supported.
remmeier added a commit that referenced this issue Mar 14, 2017
- introduced lookup behavior in KatharsisPropreties to switch between
including only paths from the requested (root) type to support arbitrary
inclusions with the include[type] syntax. The former adhering to the
JSON API spec, the later providing a powerful extension and used in
Katharsis already for quite a while (and for this reason staying the
default).
- switched abort criteria in IncludeLookupSetter from "attribute
processed" to "attribute for given resource processed". The same
attribute can this way be populated for different resources at different
positions in object graph. With this complex object graphs will get
properly supported.
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

No branches or pull requests

1 participant