-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix submissionEnvelopes/search/findByUuid endpoint #59
base: master
Are you sure you want to change the base?
Conversation
The change that stopped this endpoint from working was here I think. Seems unlikely that that is what has caused the issue as was so long ago |
This is going to cause an issue on the UI, in the submission detail view:
because of how this core api endpoint is consumed here: is it possible to update the api endpoint in state tracker instead of core? |
@@ -23,7 +23,7 @@ | |||
@RestResource(exported = false) | |||
SubmissionEnvelope findByUuid(Uuid uuid); | |||
|
|||
@RestResource(rel = "findByUuid") | |||
@RestResource(rel = "findByUuid", path = "findByUuid") | |||
SubmissionEnvelope findByUuidUuid(@Param("uuid") UUID uuid); |
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.
Why does Uuid
appear twice in the method name?
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.
Probably because of the non-exported findByUuid
method?
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.
A bit of a late response here but i can explain, this is due to the automated spring mongo methods interacting with our Uuid
class.
SubmissionEnvelope
extends AbstractEntity
which contains the uuid
property of type Uuid
from org.humancellatlas.ingest.core.Uuid
.
The Uuid
class contains a single property uuid
of type UUID
from java.util.UUID
.
So using a snippet of this example, you can see that the uuid property of the submissionEnvelope is an object containing a uuid property.
GET /submissionEnvelopes/6080a6a1dd9aab1232d308b0
{
"submissionDate" : "2021-04-21T22:26:41.995Z",
"updateDate" : "2021-04-22T00:07:18.005Z",
"user" : "601c2af3ac1792031eee4261",
"lastModifiedUser" : "anonymousUser",
"type" : "Submission",
"uuid" : {
"uuid" : "9262e9bf-5ebd-44ee-b80f-15cf107b32a5"
},
"events" : [ ]
}
So when using mongo spring repositories, the name of the method reflects where the data is being pulled from the source document.
The non-exported findByUuid
method would be used with an object containing a uuid property:
uuid_object = {"uuid": "9262e9bf-5ebd-44ee-b80f-15cf107b32a5"}
envelope = submissionEnvelopeRepository.findByUuid(uuid_object);
whereas the second method just takes the UUID, which is more usable in our rest api, Hal browser, called from ingest UI.
uuid = "9262e9bf-5ebd-44ee-b80f-15cf107b32a5"
envelope = submissionEnvelopeRepository.findByUuidUuid(uuid);
In common language whenever anyone on the team talks about the uuid they mean this "9262e9bf-5ebd-44ee-b80f-15cf107b32a5" but actually in our code that is the Uuid of the Uuid.
Why do we have a custom Uuid class? I don't know.
@ebi-ait/hca-dev we don't need this anymore right? Shall I close it? |
Would still be nice to merge, we just need to make sure if the findByUuidUuid usage is replaced.
|
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.
To make this fix easier to merge we can expose the findbyUuidUuid
method at both:
submissionEnvelopes/search/findByUuid
&
submissionEnvelopes/search/findByUuidUuid
- Which would allow us to merge this change without changing downstream components.
- Then change the consuming components to use
findByUuid
- Then make a new change here to remove the redundant
findByUuidUuid
Fix issue where findByUuid wasn't working, causing the state tracker to fail.
See Slack thread