Skip to content

Commit 6128707

Browse files
committed
ci: regenerated with OpenAPI Doc 0.2.0, Speakeay CLI 0.20.5
1 parent eb6c746 commit 6128707

File tree

5 files changed

+35
-20
lines changed

5 files changed

+35
-20
lines changed

RELEASES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
3+
## Version 0.12.1
4+
### Changes
5+
Based on:
6+
- OpenAPI Doc 0.2.0 https://docs.speakeasyapi.dev/openapi.yaml
7+
- Speakeasy CLI 0.20.5 https://github.com/speakeasy-api/speakeasy
8+
### Releases
9+
- [PyPI v0.12.1] https://pypi.org/project/speakeasy-client-sdk-python/0.12.1 - .

gen.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
management:
22
openapi-checksum: 2c73ed56562b78c36624b5eaddb0249b
33
openapi-version: 0.2.0
4-
speakeasy-version: 0.20.1
4+
speakeasy-version: 0.20.5
55
python:
6+
version: 0.12.1
7+
packagename: speakeasy-client-sdk-python
68
author: Speakeasy
79
description: Speakeasy API Client SDK for Python
8-
packagename: speakeasy-client-sdk-python
9-
version: 0.12.0
1010
telemetryenabled: null

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setuptools.setup(
1010
name="speakeasy-client-sdk-python",
11-
version="0.12.0",
11+
version="0.12.1",
1212
author="Speakeasy",
1313
description="Speakeasy API Client SDK for Python",
1414
long_description=long_description,

src/sdk/sdk.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class SDK:
3535
_security: shared.Security
3636
_server_url: str = SERVERS[SERVER_PROD]
3737
_language: str = "python"
38-
_sdk_version: str = "0.12.0"
39-
_gen_version: str = "0.20.1"
38+
_sdk_version: str = "0.12.1"
39+
_gen_version: str = "0.20.5"
4040

4141
def __init__(self) -> None:
4242
self._client = requests.Session()

src/sdk/utils/utils.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,14 @@ def serialize_json(request: dataclass) -> str:
371371
def dict_to_dataclass(orig: dict[str, any], dataclass_type: str):
372372
cast_type = str(dataclass_type).replace(
373373
"typing.Optional[", "").replace("]", "")
374-
cast_module = cast_type.split(".")[:-1]
374+
375+
cast_modules = cast_type.split(".")[:-1]
376+
if cast_modules[0] == "typing":
377+
# This is a built-in type, not a data_class
378+
return orig
379+
375380
module = None
376-
for m in cast_module:
381+
for m in cast_modules:
377382
if not module:
378383
module = __import__(m)
379384
else:
@@ -579,7 +584,7 @@ def serialize_form(data: dataclass, meta_string: str) -> dict[str, any]:
579584

580585

581586
def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_func: Callable) -> dict[str, list[str]]:
582-
params: dict[str, list[str]] = {}
587+
params: dict[str, str | list[str]] = {}
583588

584589
if is_dataclass(obj):
585590
items = []
@@ -602,12 +607,7 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f
602607
items = []
603608
for key, value in obj.items():
604609
if explode:
605-
# Python uses True and False instead of true and false for booleans;
606-
# This json encodes the values _only_ if the value is a boolean.
607-
if value is True or value is False:
608-
params[key] = json.dumps(value)
609-
else:
610-
params[key] = value
610+
_populate_simple_param(params, key, value)
611611
else:
612612
items.append(f'{key},{value}')
613613

@@ -627,11 +627,20 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f
627627
if len(items) > 0:
628628
params[field_name] = [','.join([str(item) for item in items])]
629629
else:
630-
params[field_name] = obj
630+
_populate_simple_param(params, field_name, obj)
631631

632632
return params
633633

634634

635+
def _populate_simple_param(params: dict[str, str | list[str]], field_name: str, value: any):
636+
# Python uses True and False instead of true and false for booleans;
637+
# This json encodes the values _only_ if the value is a boolean.
638+
if value is True or value is False:
639+
params[field_name] = json.dumps(value)
640+
else:
641+
params[field_name] = value
642+
643+
635644
def _serialize_header(explode: boolean, obj: any) -> str:
636645
if is_dataclass(obj):
637646
items = []
@@ -675,11 +684,8 @@ def _serialize_header(explode: boolean, obj: any) -> str:
675684

676685

677686
def unmarshal_json(data, t):
678-
Unmarhsal = make_dataclass('Unmarhsal', [('res', t)],
679-
bases=(DataClassJsonMixin,))
680687
d = json.loads(data)
681-
out = Unmarhsal.from_dict({"res": d})
682-
return out.res
688+
return dict_to_dataclass(d, t)
683689

684690

685691
def marshal_json(c):

0 commit comments

Comments
 (0)