Open tschaffter opened 11 months ago
The issue is that the auto-generated API client does not seem to support object as query params. Consider the following code from challenge_api.py
:
# process the query parameters
_query_params = []
_query_params.append(('pageSize', 1000))
# if _params.get('challenge_search_query') is not None: # noqa: E501
# _query_params.append(('challengeSearchQuery', _params['challenge_search_query']))
This adds a query param named challengeSearchQuery
, which is not supported the auto-generated client.
This is not the first time that an issue arise because we use an object, which was decided because this enables to group the params in one schema. While this works fine with code generated for the Java server, Angular and Axios cients, there was also an issue in R. The issue was reported to the official repo of OpenAPI Generator. Was the fix supposed to fix exactly this issue for R?
Note It is also more developer friendly to have the query params grouped into a single object.
The easiest path forward would be to update the API description to no longer rely on objects for query params. This change should have minimal impact on existing implementation. The change should be tested on a single endpoint first.
I have "hacked" the API client locally so that I could fetch all the challenges on one page:
# process the query parameters
_query_params = []
_query_params.append(('pageSize', 1000))
# if _params.get('challenge_search_query') is not None: # noqa: E501
# _query_params.append(('challengeSearchQuery', _params['challenge_search_query']))
I didn't have time to address this in November but am now aiming to fix this bug this sprint. I will also devise a plan to release the Python client in January, which will be one of the highlight of OC. E.g. we should provide a Python notebook that shows how to use the API client, e.g. to get a list of challenges or the papers (DOI) of the challenges an org has contributed to.
Added to Sprint 23.12
Added to Backlog
Is there an existing issue for this?
What product(s) are you seeing the problem on?
OpenChallenges
Current behavior
I'm trying to get all the challenges. The query shown below shows that all the challenges can be listed on a single page.
https://openchallenges.io/api/v1/challenges?sort=created&pageSize=1000
The following code fails to do the same in Python:
The page size return is always 3 and the number of results per page is 100, independently of the value of
query
. 100 is the default page size. However, I updated the API description, regenerated the API client and reinstalled it. The client code shows that the change is effective, but my script still fetch 100 challenges per page.Expected behavior
No response
Anything else?
No response
Commit ID
No response
Are you developing inside the dev container?
Code of Conduct