From 29b4a60c3a6e504e3d4149bc7580e2f1bd8ab21b Mon Sep 17 00:00:00 2001 From: Rory Schadler <48921090+roryschadler@users.noreply.github.com> Date: Wed, 7 Aug 2024 13:09:27 -0400 Subject: [PATCH] fix: int serialization for multipart requests urllib3 handles serializing ints in post params (ref 1), while asyncio explicitly does not (ref 2). ref 1: ref 2: --- .../src/main/resources/python/asyncio/rest.mustache | 2 ++ .../client/petstore/python-aiohttp/petstore_api/rest.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache b/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache index 70b8f6911089..469344ccaab4 100644 --- a/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache +++ b/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache @@ -177,6 +177,8 @@ class RESTClientObject: # Ensures that dict objects are serialized if isinstance(v, dict): v = json.dumps(v) + elif isinstance(v, int): + v = str(v) data.add_field(k, v) args["data"] = data diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/rest.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/rest.py index 3a055c46f9f7..a5e16a9d8ea0 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/rest.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/rest.py @@ -187,6 +187,8 @@ async def request( # Ensures that dict objects are serialized if isinstance(v, dict): v = json.dumps(v) + elif isinstance(v, int): + v = str(v) data.add_field(k, v) args["data"] = data