Skip to content

Commit e82d241

Browse files
committed
Removed None paramaters from query params, as this can cause issuses with pagination in FastAPI
1 parent 2c95fe4 commit e82d241

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/openapi_python_generator/language_converters/python/templates/httpx.jinja2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
{% endif %}
1313
}
1414

15+
query_params = {key:value for (key,value) in query_params.items() if value is not None}
16+
1517
{% if async_client %}
1618
async with httpx.AsyncClient(base_url=base_path) as client:
1719
response = await client.request(

src/openapi_python_generator/language_converters/python/templates/requests.jinja2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ def {{ operation_id }}({{ params }}) -> {% if return_type.type is none or return
1212
{% endif %}
1313
}
1414

15+
query_params = {key:value for (key,value) in query_params.items() if value is not None}
16+
1517
response = requests.request(
1618
'{{ method }}',
1719
f'{base_path}{path}',

0 commit comments

Comments
 (0)