Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
REST API: POST endpoint for QueryBuilder queryhelp JSON payloads #4337
REST API: POST endpoint for QueryBuilder queryhelp JSON payloads #4337
Changes from all commits
9e584dd
a4ec512
4c9d44a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Oh, I see, so here is where the
full_type
is set?Just for me to understand: This is the
NodeTranslator
class, but for some reason it also seems to be used to translate objects that are not nodes - is that the source of the problem?And, finally, I guess you tried before instead of setting
full_type
toNone
to simply not set it here, but then tests break?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.
Yeah, so this is what I tried to explain in previous comment answers.
The only way to get all the various REST API-specific information in the response (and make it the most similar to other REST API responses), I need to use
NodeTranslator
as the translator class for the/querybuilder
-endpoint.This is because the
NodeTranslator
is special, addingfull_type
, which is not a property that otherwise exists in AiiDA. It's a quirk of the REST API.As far as I know, this is the only addition to an AiiDA entity, and as such, if I use
NodeTranslator
for all entities, I make sure I also include the special REST API properties. The need for the subsequent removal offull_type
should now be clear - it's not a property of any other AiiDA entity thanNode
s. And even then, to definefull_type
bothnode_type
andprocess_type
are needed. If these properties are not requested in the POSTed queryhelp, they will not be available.I could here ensure that they're always requested, but that would demand a lot of logic to go through the POSTed queryhelp. Something I didn't feel was necessary for this PR at this point. So instead I've opted for the current solution.
It's worth noting that the
construct_full_type
utility function actually had a bug. It usedprocess_type
twice (for bothnode_type
andprocess_type
parts offull_type
). This PR fixes that bug, as well as remove the necessity fortry/except
in the highlighted code.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.
It was more of a conscious choice to make the response as AiiDA REST API-like as possible. Including all the extra properties expected from any other AiiDA REST API response for the various entities.
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.
The main issue here relates to the fact that the REST API was not built to return multiple types of entities (this has been mentioned in issue #4676 as well). So I need a "catch-em-all"/"works-for-all"-translator :)