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
Issue 1148 - Adding new Relationships in Edit Item is difficult for entities with many relationships #3368
Issue 1148 - Adding new Relationships in Edit Item is difficult for entities with many relationships #3368
Conversation
…earch/byEntityType?type={entityTypeLabel}` and `search/byEntityTypeId?id={entityTypeId}`)
… or linkRests, links are not removed yet
…lationshiptypes-by-entitytype' into w2p-80497_HAL-links-in-property-based-projections
…s-in-property-based-projections
@benbosman : Took a look at this today, and this implementation doesn't look RESTful to me, for the same reasons I've discussed in the Contract at DSpace/RestContract#165. Let me see if I can describe these reasons more clearly based on this implementation.
The same sort of idea could also be applied to
To sum up, I don't think my suggestions will vastly modify this PR. But, these small changes would immediately make this endpoint behave in a more RESTful fashion, because the values of returned Item properties would no longer depend heavily on the parameters passed in. This allows caches or clients to more easily combine property information across multiple requests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tdonohue @benbosman sorry but I have to disagree about the direction of this PR. It is not about making it more or less restful we need to agree in advance on the REST contract picking the easier solution both for immediate implementation that for long term maintenance. As discussed in the REST contract DSpace/RestContract#165 (comment) I strongly feel that we can support our needs just using search methods without increase the complexity of our projection framework.
We should be very careful about having dynamic property in our rest resource this kind of stuff make much harder to support HATEOAS principles. The rest client should be able to get a comprensive description of how the response will look like, the ALPS standard that we would like to implement at some point would need to describe what a projection does and if we diverge from the spring data rest community practices.... we will be alone.
Another example of a violation of a common understanding due to the introduction of this projection is the "full" projection, the full will not include the dynamic properties so it will be not longer "full". Attempts to fix that would be complex and result in major performance overhead for 99% of use cases that really don't need these additional information.
Closing this implementation PR in favor of the approach defined in DSpace/RestContract#170 (a non-projection based approach). That said, if we find that approach falls short in significant ways, we can always revisit this idea to implement via a custom type of projection |
References
Add references/links to any related issues or PRs. These may include:
Description
This PR adds the new projections from DSpace/RestContract#165
As discussed in the previous community meeting, a PR has been created for this work to help clarify what it does.
This PR should clarify:
Instructions for Reviewers
I'm including some sample tests here:
CheckRelatedItem
/server/api/core/items/a7e2ca60-5d0e-4d41-9457-9ab04702e18b?projection=CheckRelatedItem&checkRelatedItem=8d60686a-cfad-42fb-88b0-33a482fa3346&embed=relationships
The main item contains:
For the links in the main item:
/server/api/core/items/a7e2ca60-5d0e-4d41-9457-9ab04702e18b?checkRelatedItem=8d60686a-cfad-42fb-88b0-33a482fa3346&projection=CheckRelatedItem
(ensuring the cache is still valid)For the links in the relationships:
/server/api/core/items/afa5e55d-0827-46dc-b292-2dbe10b40b97?checkRelatedItem=8d60686a-cfad-42fb-88b0-33a482fa3346&projection=CheckRelatedItem
(ensuring the cache is still valid)CheckSideItemInRelationship
/server/#/server/api/core/items/a7e2ca60-5d0e-4d41-9457-9ab04702e18b?projection=CheckSideItemInRelationship&checkSideItemInRelationship=a7e2ca60-5d0e-4d41-9457-9ab04702e18b&embed=relationships
For the links in the main item:
/server/api/core/items/a7e2ca60-5d0e-4d41-9457-9ab04702e18b/relationships?checkSideItemInRelationship=a7e2ca60-5d0e-4d41-9457-9ab04702e18b&projection=CheckSideItemInRelationship
For the links in the relationships:
/server/api/core/relationships/1305?checkSideItemInRelationship=a7e2ca60-5d0e-4d41-9457-9ab04702e18b&projection=CheckSideItemInRelationship
The relationship has the properties: