[python] serialize booleans as lowercase in all parameter styles

Merged
FA
3mo ago
+145-37

Boolean parameters serialize as Python True/False in every place except a top-level query value, so a strict server rejects them.

parameters_to_url_query lowercased a scalar boolean query value, but booleans inside a collection went through str():

?flags=True,False        # csv array
?multi=True&multi=False  # exploded array

Path, header and form parameters had no boolean handling at all:

/pets/True               # boolean path param

The fix lowercases booleans in parameters_to_tuples (covers path, header, form and the multi branch) and in the collection branches of parameters_to_url_query. After it:

/pets/true
?single=false&flags=true,false&multi=true&multi=false

and boolean headers serialize as true.

Verified against a generated client covering path / query (scalar, csv, exploded) / header booleans; petstore sample tests still pass.

PR checklist

  • Read the contribution guidelines.
  • Ran ./mvnw clean package and regenerated the python samples.
  • Filed the PR against master.

/cc @cbornet @tomplus @krjakbrjak


Summary by cubic

Lowercase boolean serialization across all Python client parameter styles to ensure servers receive true/false instead of True/False. Fixes strict servers rejecting mixed-case booleans.

  • Bug Fixes
    • Lowercase bools in path, header, form, and query (scalar, csv, multi).
    • Implemented in parameters_to_tuples and collection handling in parameters_to_url_query.
    • Regenerated Python samples and updated echo_api header test to expect true.