Skip to content

Resolve minor JSON:API issues - #158

Merged
edan-bainglass merged 5 commits into
aiidateam:masterfrom
edan-bainglass:jsonapi-normalization
Jul 30, 2026
Merged

edan-bainglass merged 5 commits into
aiidateam:masterfrom
edan-bainglass:jsonapi-normalization

Conversation

@edan-bainglass

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

Copy link
Copy Markdown
Member

This PR refactors and centralizes the handling of JSON:API and JSON
Schema responses throughout the codebase. It introduces new response
classes in a shared module, updates all routers to use these classes,
and moves error handling utilities to a dedicated module. Additionally,
the daemon router endpoints are updated to return plain dictionaries
instead of Pydantic models for status responses.

The PR also fixes a bug in the nodes schema endpoint to ensure the
correct model is selected based on the which parameter.

@edan-bainglass
edan-bainglass force-pushed the jsonapi-normalization branch from 593fde6 to b071632 Compare July 27, 2026 06:08
@codecov-commenter

codecov-commenter commented Jul 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.77778% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.09%. Comparing base (d17ed6e) to head (fa0fa2d).

Files with missing lines Patch % Lines
aiida_restapi/routers/nodes.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #158      +/-   ##
==========================================
+ Coverage   89.06%   89.09%   +0.02%     
==========================================
  Files          49       50       +1     
  Lines        2030     2035       +5     
==========================================
+ Hits         1808     1813       +5     
  Misses        222      222              
Flag Coverage Δ
pytests 89.09% <97.77%> (+0.02%) ⬆️

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-normalization branch from b071632 to a795740 Compare July 30, 2026 04:15
@edan-bainglass edan-bainglass self-assigned this Jul 30, 2026
@edan-bainglass edan-bainglass changed the title Jsonapi normalization Resolve minor JSON:API issues Jul 30, 2026

@Bud-Macaulay Bud-Macaulay left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A lot of small changes to return types, i guess you were having issues with json api.

Happy to approve if it works on your end.

@edan-bainglass

edan-bainglass commented Jul 30, 2026 •

Copy link
Copy Markdown
Member Author

A lot of small changes to return types, i guess you were having issues with json api.

The return types changes are for consistency. In the original work (#101), I had to change the return type to dict and let it run against the specific response model, instead of returning the model itself, which caused issues due to the abstractness of the JSON:API adapter system. Hence, I found it in general better to return raw dicts and only use Pydantic as a validation gate.

@edan-bainglass
edan-bainglass force-pushed the jsonapi-normalization branch from a795740 to 93aa06c Compare July 30, 2026 10:34
@edan-bainglass
edan-bainglass force-pushed the jsonapi-normalization branch from 93aa06c to fa0fa2d Compare July 30, 2026 11:00
@edan-bainglass
edan-bainglass merged commit ae6adf2 into aiidateam:master Jul 30, 2026
4 of 5 checks passed
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.

3 participants