Repository navigation
Schema: Require pagination limit parameter - #9547
Conversation
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #9547 +/- ##
=======================================
Coverage 86.36% 86.36%
=======================================
Files 1229 1229
Lines 54043 54050 +7
Branches 2275 2275
=======================================
+ Hits 46672 46682 +10
+ Misses 6796 6793 -3
Partials 575 575
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Looks interesting; #9481 should address this generally |
|
@1337joe does this change the actual behavior of the API, or just the documentation schema? I ask because there are certainly some API endpoints where we make use of this "default" behavior and do not expect (or desire) any pagination. |
|
@SchrodingersGat I made the changes in the AutoSchema class so that it would only affect the schema. The API itself will remain unchanged, but the schema will be generated with limit required. |
|
Ok, thanks for the clarification. We should review which endpoints we do not want to be paginated (it is only a limited set that we use that way) and perhaps mark them as such? However, for this PR we are just updating the documentation schema, so this looks good to go. |

I'm offering this as a possible solution to the linked issue, I don't know if it's something we want.
Problem: If a pagination limit is not provided in a list query, the response comes back as a list of all relevant objects, not a paginated wrapper object as the schema defines.
Solution: Require
limitto be set on list queries. That way if you're following the schema specification when you make the call the response you get also follows the schema specification.This completely ignores/hides the shape changing nature of the current API for list endpoints.
Fixes #9195