fix: operations api licenses limit and offset parameters #1540
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Related to: #1432
Due to this python-fastapi issue, the limit and offset parameters are raising errors at the operations API. While the public API works as expected, in the operations API the parameter is passed as a string by the GCP functions raising the following error:
Expected behavior:
The limit and the offset are properly processed when are set in the query parameters
Testing tips:
From our AI friend
This pull request updates the handling of pagination parameters for the licenses endpoint in both the OpenAPI specification and the backend implementation. The main focus is to work around an issue with the OpenAPI generator by treating
limitandoffsetas strings rather than integers, and to refactor the API implementation for clarity and correctness.OpenAPI Spec and Pagination Handling:
limitandoffsetquery parameters in thegetLicensesendpoint indocs/OperationsAPI.yamlto be defined as strings (with default and example values), due to an issue with the OpenAPI generator.Backend Implementation Refactor:
LicensesApiImplclass inlicenses_api_impl.py:get_licenseandget_licensesinto separate handler methods (handle_get_license,handle_get_licenses) and made the public API methods (get_license,get_licenses) async wrappers that call these handlers. [1] [2] [3]get_licensesand its handler to acceptlimitandoffsetas strings (with defaults), converting them to integers before using them for pagination. [1] [2] [3]Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.shto make sure you didn't break anything