Skip to content

Conversation

@matmair
Copy link
Contributor

@matmair matmair commented Dec 17, 2025

Replaces individual metadata endpoints with a generic endpoint and a bunch of permanent redirects. Obviously a breaking change.
This:

  • reduces the amount of duplicated endpoints doing the same things and the required tests too
  • removes the necessity to declare new endpoints for every metadata-supporting model
  • is plugin friendly as models defined in those can also use the new endpoint

Requires a change to the client libary - inventree/inventree-python#285

@matmair matmair added this to the 2.0.0 milestone Dec 17, 2025
@matmair matmair self-assigned this Dec 17, 2025
@matmair matmair added plugin Plugin ecosystem api Relates to the API breaking Indicates a major update or change which breaks compatibility labels Dec 17, 2025
@netlify
Copy link

netlify bot commented Dec 17, 2025

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit d61155d
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/695cefe631b4860008e5311f
😎 Deploy Preview https://deploy-preview-11035--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 88 (🔴 down 6 from production)
Accessibility: 81 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

❌ Patch coverage is 88.60759% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.16%. Comparing base (d92672d) to head (d61155d).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11035      +/-   ##
==========================================
- Coverage   88.18%   88.16%   -0.02%     
==========================================
  Files        1290     1290              
  Lines       58142    58145       +3     
  Branches     1969     1969              
==========================================
- Hits        51272    51264       -8     
- Misses       6379     6390      +11     
  Partials      491      491              
Flag Coverage Δ
backend 89.46% <88.60%> (-0.03%) ⬇️

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

Components Coverage Δ
Backend Apps 92.01% <100.00%> (-0.02%) ⬇️
Backend General 93.48% <100.00%> (ø)
Frontend 70.85% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@matmair matmair changed the title WIP refactor(backend): reduce surface by unifying metadata endpoints refactor(backend): reduce surface by unifying metadata endpoints Jan 5, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 6, 2026

CodSpeed Performance Report

Merging #11035 will not alter performance

Comparing matmair:reduce-metadata-endpoints (d61155d) with master (025f6ff)1

Summary

✅ 2 untouched
🆕 27 new

Benchmarks breakdown

Benchmark BASE HEAD Efficiency
🆕 test_api_options_performance[/api/build/item/] N/A 4.8 ms N/A
🆕 test_api_options_performance[/api/build/line/] N/A 5.2 ms N/A
🆕 test_api_options_performance[/api/parameter/template/] N/A 3.7 ms N/A
🆕 test_api_options_performance[/api/stock/location/] N/A 4 ms N/A
🆕 test_api_options_performance[/api/company/] N/A 4.1 ms N/A
🆕 test_api_options_performance[/api/user/roles/] N/A 3.6 ms N/A
🆕 test_api_options_performance[/api/part/] N/A 5.6 ms N/A
🆕 test_api_options_performance[/api/order/po/] N/A 4.8 ms N/A
🆕 test_api_list_performance[/api/build/item/] N/A 3.6 ms N/A
🆕 test_api_auth_performance N/A 10.7 ms N/A
🆕 test_api_list_performance[/api/order/so/shipment/] N/A 3.6 ms N/A
🆕 test_api_options_performance[/api/order/so/shipment/] N/A 4.9 ms N/A
🆕 test_api_list_performance[/api/company/] N/A 3.7 ms N/A
🆕 test_api_options_performance[/api/part/category/] N/A 3.8 ms N/A
🆕 test_api_list_performance[/api/parameter/] N/A 3.7 ms N/A
🆕 test_api_list_performance[/api/build/] N/A 3.9 ms N/A
🆕 test_api_options_performance[/api/order/so/] N/A 4.7 ms N/A
🆕 test_api_options_performance[/api/parameter/] N/A 4 ms N/A
🆕 test_api_options_performance[/api/order/po-line/] N/A 5.9 ms N/A
🆕 test_api_list_performance[/api/parameter/template/] N/A 3.6 ms N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Footnotes

  1. No successful run was found on master (d92672d) during the generation of this report, so 025f6ff was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@matmair
Copy link
Contributor Author

matmair commented Jan 6, 2026

@SchrodingersGat this is ready for review, the needed change for the API client is already proposed inventree/inventree-python#285

You can see the passing test with that branch in https://github.com/inventree/InvenTree/actions/runs/20733404036/job/59525935718

@matmair matmair marked this pull request as ready for review January 6, 2026 00:47
@SchrodingersGat
Copy link
Member

@matmair this does look a lot cleaner.

To confirm what you are doing here - all metadata is accessed via /api/metadata/pk/ - but the existing URLs all continue to work via redirect?

@matmair
Copy link
Contributor Author

matmair commented Jan 6, 2026

@SchrodingersGat it sends a permanent redirect. If the client follows the redirect it still works. Most clients do that for GET but not for POST/PATCH, it is often configurable. That is largely why I marked the PR as breaking.

@matmair
Copy link
Contributor Author

matmair commented Jan 6, 2026

Metadata is accessed via /api/metadata/<model>/<pk>/

@matmair matmair modified the milestones: 2.0.0, 1.2.0 Jan 6, 2026
@matmair matmair changed the title refactor(backend): reduce surface by unifying metadata endpoints refactor(backend): reduce API surface by unifying metadata endpoints Jan 6, 2026
@SchrodingersGat
Copy link
Member

Happy with this to merge?

@matmair
Copy link
Contributor Author

matmair commented Jan 6, 2026

Yes

@SchrodingersGat SchrodingersGat merged commit 5b290f4 into inventree:master Jan 6, 2026
37 checks passed
@SchrodingersGat SchrodingersGat deleted the reduce-metadata-endpoints branch January 6, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API breaking Indicates a major update or change which breaks compatibility plugin Plugin ecosystem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants