Skip to content

Conform query parameters to JSON:API specs - #157

Open
edan-bainglass wants to merge 1 commit into
aiidateam:masterfrom
edan-bainglass:jsonapi-query-params
Open

edan-bainglass wants to merge 1 commit into
aiidateam:masterfrom
edan-bainglass:jsonapi-query-params

Conversation

@edan-bainglass

@edan-bainglass edan-bainglass commented Jul 27, 2026 •

Copy link
Copy Markdown
Member

This PR aligns query parameters with JSON:API specs. See README.md for details.

@codecov-commenter

codecov-commenter commented Jul 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.16239% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.24%. Comparing base (2c174ed) to head (217c963).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
aiida_restapi/common/query.py 91.48% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #157      +/-   ##
==========================================
+ Coverage   89.09%   89.24%   +0.14%     
==========================================
  Files          50       50              
  Lines        2036     2110      +74     
==========================================
+ Hits         1814     1883      +69     
- Misses        222      227       +5     
Flag Coverage Δ
pytests 89.24% <93.16%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@edan-bainglass
edan-bainglass force-pushed the jsonapi-query-params branch 3 times, most recently from ee48dea to b0b3c79 Compare July 29, 2026 13:29
@edan-bainglass edan-bainglass self-assigned this Jul 30, 2026
@edan-bainglass edan-bainglass changed the title Jsonapi query params Conform query parameters to JSON:API specs Jul 30, 2026
@edan-bainglass
edan-bainglass force-pushed the jsonapi-query-params branch 4 times, most recently from 59234f7 to 2521d9d Compare July 31, 2026 10:45
@edan-bainglass

edan-bainglass commented Jul 31, 2026 •

Copy link
Copy Markdown
Member Author

@Bud-Macaulay a few things:

  1. Don't mind the failing test. That's due to a recent aiida-core change to be addressed shortly - see #7507 degrades the Pydantic model system 🥲 aiida-core#7508
  2. It remains to be decided if such a "sophisticated" query parameter system is needed in light of the QE endpoint (and a stable GraphQL endpoint), though I would argue JSON:API-based query params are still a nice shortcut
  3. Have a look at how I construct pagination links w.r.t existing query params at the bottom of this file. I may be overthinking it, but without the safe characters, pagination links looked like a string of % signs 🥲 Not so friendly, but maybe this stuff is not for humans to read anyhow. Second opinion 🙏
  4. In the current state, we have the following validations:
    a. DB validation for field names at the router entity level (e.g., pinging the /nodes endpoint with filter[metadata] will naturally raise a validation error - metadata is not a field of nodes), but attributes.whatever is not validated, nor is it in the QueryBuilder itself!
    b. Operator validation is done against a set of allowed operations, but we do not validate if the operator is valid for the field, nor does the QueryBuilder!

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.

2 participants