Skip to content

Conversation

@davidgamez
Copy link
Member

@davidgamez davidgamez commented Jan 7, 2026

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:

{
  "detail": [
    {
      "type": "int_type",
      "loc": [
        "query",
        "limit"
      ],
      "msg": "Input should be a valid integer",
      "input": "10"
    }
  ]
}

Expected behavior:
The limit and the offset are properly processed when are set in the query parameters

Testing tips:

  • Start the service locally
  • Use the following request:
curl --request GET \
  --url 'http://localhost:8080/v1/operations/licenses?limit=10' 

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 limit and offset as strings rather than integers, and to refactor the API implementation for clarity and correctness.

OpenAPI Spec and Pagination Handling:

  • Changed the limit and offset query parameters in the getLicenses endpoint in docs/OperationsAPI.yaml to be defined as strings (with default and example values), due to an issue with the OpenAPI generator.

Backend Implementation Refactor:

  • Refactored the LicensesApiImpl class in licenses_api_impl.py:
    • Split the logic for get_license and get_licenses into 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]
    • Updated the get_licenses and its handler to accept limit and offset as 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!

  • Run the unit tests with ./scripts/api-tests.sh to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

@davidgamez davidgamez changed the title Fix/op api licenses parameters fix: operations api licenses limit and offset parameters Jan 7, 2026
@davidgamez davidgamez marked this pull request as ready for review January 7, 2026 19:32
Copy link
Contributor

@cka-y cka-y left a comment

Choose a reason for hiding this comment

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

LGTM

@jcpitre
Copy link
Collaborator

jcpitre commented Jan 8, 2026

Just curious: Do you know it does not happen with the public API?

@davidgamez
Copy link
Member Author

davidgamez commented Jan 8, 2026

Just curious: Do you know it does not happen with the public API?

I tested it in PROD, and it's not happening. There are two main differences:

  • Generator version differences 7.5.0(public) vs 7.10.0(operations). We should keep an eye on when upgrading the generator.
  • The public API is a Cloud Service, and the operations is a Cloud Function. It's possible that the latter "processes" the parameters before calling the entry point.

@davidgamez davidgamez merged commit 2674f27 into main Jan 8, 2026
2 of 3 checks passed
@davidgamez davidgamez deleted the fix/op_api_licenses_parameters branch January 8, 2026 14:45
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.

4 participants