Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] parameters_to_url_query returns booleans with upper letter #16941

Closed
6 tasks
mhaley-tignis opened this issue Oct 30, 2023 · 1 comment
Closed
6 tasks

Comments

@mhaley-tignis
Copy link
Contributor

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 parameters_to_url_query function incorrectly produces True and False for boolean values. This piece of code in the api_client template is responsible:

if isinstance(v, (int, float)):
v = str(v)
if isinstance(v, bool):
v = str(v).lower()

In python isinstance(True, int) == True :)

openapi-generator version

v7.0.1

OpenAPI declaration file content or url

N/A

Generation Details

N/A

Steps to reproduce

N/A

Related issues/PRs
Suggest a fix

Swap the order of the checks to first check for booleans:

            if isinstance(v, bool):
                v = str(v).lower()
            if isinstance(v, (int, float)):
                v = str(v)
@robertschweizer
Copy link
Contributor

This can be closed since #16947 was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants