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

Fix REST API attributes_filter and extras_filter #3556

Merged

Conversation

elsapassaro
Copy link
Contributor

Fixes #3555.

The REST API attributes_filter and extras_filter were not working correctly when pagination is requested.
Without pagination they return attributes and extras dictionaries with the keys specified in attributes_filter and extras_filter as expected.
When pagination is added they return instead the attributes keys as attributes.key, which is not consistent with the expected behaviour.

Changed REST API version to 4.0.1.

The node_type had a final dot missing in the
hard-coded mapping to generate the correct full
types for process node namespaces of external plugins.
Fixes aiidateam#3555.
The REST API attributes_filter and extras_filter were not working
correctly when pagination is requested.
Without pagination they return attributes and extras dictionaries
with the keys specified in attributes_filter and extras_filter
as expected.
When pagination is added they return instead the attributes keys
as attributes.key, which is not consistent with the expected
behavior.
@giovannipizzi
Copy link
Member

Thanks!

Could you add a test to check this please?

@sphuber
Copy link
Contributor

sphuber commented Nov 21, 2019

@asle85 could you please still add the additional tests that we discussed? Then I can merge this and prepare the release. Thanks

@elsapassaro
Copy link
Contributor Author

Improved tests on attributes_filter and extras_filter and added the two additional tests.

Copy link
Contributor

@sphuber sphuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @asle85 , there is one final thing to fix. If you could do that and then make sure the branch is up to date with develop I can approve and merge.

############### node get one attributes_filter with pagination #############
def test_node_single_attributes_filter(self):
"""
Check that when only one node extra is specified in extras_filter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You still have "extra" twice in this docstring but should be "attribute".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, fixed it.

Improved tests on attributes_filter and extras_filter
with pagination. Added tests to check only one attribute
or extra filter together with pagination.
@elsapassaro elsapassaro force-pushed the fix_3555_restapi_attributes_filter branch from 2a45827 to 55a1512 Compare November 22, 2019 08:57
@sphuber sphuber merged commit 6a66c6b into aiidateam:develop Nov 22, 2019
@sphuber
Copy link
Contributor

sphuber commented Nov 22, 2019

Thanks @asle85

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.

REST API: attributes_filter and extras_filter filters not working properly with pagination
3 participants