Skip to content

Commit 5b40b32

Browse files
committed
Generated samples for new rest.py templates
1 parent fc9b7ea commit 5b40b32

6 files changed

Lines changed: 13 additions & 0 deletions

File tree

  • samples
    • client/echo_api/python-pydantic-v1/openapi_client
    • openapi3/client/petstore
      • python-aiohttp/petstore_api
      • python-httpx/petstore_api
      • python-pydantic-v1-aiohttp/petstore_api
      • python-pydantic-v1/petstore_api

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,3 +309,6 @@ samples/client/petstore/ocaml-recursion-test/_build/
309309

310310
# jetbrain http client
311311
samples/client/jetbrains/adyen/checkout71/http/client/Apis/http-client.private.env.json
312+
313+
# Generated by the run-in-docker.sh
314+
?/

samples/client/echo_api/python-pydantic-v1/openapi_client/rest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ def request(self, method, url, query_params=None, headers=None,
182182
request_body = None
183183
if body is not None:
184184
request_body = json.dumps(body)
185+
if body is None and post_params:
186+
request_body = json.dumps(dict(post_params))
185187
r = self.pool_manager.request(
186188
method, url,
187189
body=request_body,

samples/openapi3/client/petstore/python-aiohttp/petstore_api/rest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ async def request(
165165
if re.search('json', headers['Content-Type'], re.IGNORECASE):
166166
if body is not None:
167167
body = json.dumps(body)
168+
if body is None and post_params:
169+
body = json.dumps(dict(post_params))
168170
args["data"] = body
169171
elif headers['Content-Type'] == 'application/x-www-form-urlencoded':
170172
args["data"] = aiohttp.FormData(post_params)

samples/openapi3/client/petstore/python-httpx/petstore_api/rest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ async def request(
137137
if re.search('json', headers['Content-Type'], re.IGNORECASE):
138138
if body is not None:
139139
args["json"] = body
140+
if body is None and post_params:
141+
args["json"] = dict(post_params)
140142
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
141143
args["data"] = dict(post_params)
142144
elif headers['Content-Type'] == 'multipart/form-data':

samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/rest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ async def request(self, method, url, query_params=None, headers=None,
137137
if re.search('json', headers['Content-Type'], re.IGNORECASE):
138138
if body is not None:
139139
body = json.dumps(body)
140+
if body is None and post_params:
141+
body = json.dumps(dict(post_params))
140142
args["data"] = body
141143
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
142144
args["data"] = aiohttp.FormData(post_params)

samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/rest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ def request(self, method, url, query_params=None, headers=None,
181181
request_body = None
182182
if body is not None:
183183
request_body = json.dumps(body)
184+
if body is None and post_params:
185+
request_body = json.dumps(dict(post_params))
184186
r = self.pool_manager.request(
185187
method, url,
186188
body=request_body,

0 commit comments

Comments
 (0)