OpenAPITools / OpenAPITools/openapi-generator

[BUG] [python-nextgen]The method "parameters_to_url_query" throws an error when the input is of type List[int] because the join operation expects string types, but it is being applied to integers.

Open
#15,788 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Python Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

The method "parameters_to_url_query" throws an error when the input is of type List[int] because the join operation expects string types, but it is being applied to integers.

input is of type List[int]
Annotated[Optional[conlist(StrictInt)]

Run error

 File "xx\api_client.py", line 552, in <listcomp>
    return "&".join(["=".join(item) for item in new_params])
TypeError: sequence item 1: expected str instance, int found

api_client.py Lines of code

552 return "&".join(["=".join(item) for item in new_params])

Local modification valid
return "&".join(["=".join(str(item)) for item in new_params])

openapi-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in api_client.py around line 552 and reproduce the failure with a List[int] input such as Annotated[Optional[conlist(StrictInt)]]. Verify the parameters_to_url_query path and confirm that integer values no longer trigger the reported TypeError when building the URL query.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.