Skip to content

Commit

Permalink
ci: regenerated with OpenAPI Doc 1.0.0, Speakeay CLI 1.82.5
Browse files Browse the repository at this point in the history
  • Loading branch information
speakeasybot committed Sep 12, 2023
1 parent 0ca935c commit f70312d
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 18 deletions.
10 changes: 9 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,12 @@ Based on:
- OpenAPI Doc 1.0.0
- Speakeasy CLI 1.78.3 (2.96.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v0.4.2] .
- [python v0.4.2] .

## 2023-09-12 01:10:22
### Changes
Based on:
- OpenAPI Doc 1.0.0
- Speakeasy CLI 1.82.5 (2.108.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v0.4.3] .
2 changes: 0 additions & 2 deletions docs/models/shared/error.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Error

unexpected error


## Fields

Expand Down
2 changes: 0 additions & 2 deletions docs/models/shared/pet.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Pet

Expected response to a valid request


## Fields

Expand Down
8 changes: 4 additions & 4 deletions gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ configVersion: 1.0.0
management:
docChecksum: 2516596125ef223fbbef6c434d22eaac
docVersion: 1.0.0
speakeasyVersion: 1.78.3
generationVersion: 2.96.3
speakeasyVersion: 1.82.5
generationVersion: 2.108.3
generation:
comments:
disableComments: false
Expand All @@ -14,10 +14,10 @@ generation:
tagNamespacingDisabled: false
features:
python:
core: 2.85.3
core: 2.85.4
globalServerURLs: 2.82.0
python:
version: 0.4.2
version: 0.4.3
author: my-test
clientServerStatusCodesAsErrors: true
description: Python Client SDK Generated by Speakeasy
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setuptools.setup(
name="test",
version="0.4.2",
version="0.4.3",
author="my-test",
description="Python Client SDK Generated by Speakeasy",
long_description=long_description,
Expand Down
1 change: 0 additions & 1 deletion src/test/models/shared/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

@dataclasses.dataclass
class Error:
r"""unexpected error"""
code: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('code') }})
message: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('message') }})

Expand Down
1 change: 0 additions & 1 deletion src/test/models/shared/pet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

@dataclasses.dataclass
class Pet:
r"""Expected response to a valid request"""
id: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('id') }})
name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('name') }})
tag: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('tag'), 'exclude': lambda f: f is None }})
Expand Down
9 changes: 6 additions & 3 deletions src/test/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def __init__(self,
server_idx: int = None,
server_url: str = None,
url_params: dict[str, str] = None,
client: requests_http.Session = None
client: requests_http.Session = None,
retry_config: utils.RetryConfig = None
) -> None:
"""Instantiates the SDK configuring it with the provided parameters.
Expand All @@ -25,7 +26,9 @@ def __init__(self,
:param url_params: Parameters to optionally template the server URL with
:type url_params: dict[str, str]
:param client: The requests.Session HTTP client to use for all operations
:type client: requests_http.Session
:type client: requests_http.Session
:param retry_config: The utils.RetryConfig to use globally
:type retry_config: utils.RetryConfig
"""
if client is None:
client = requests_http.Session()
Expand All @@ -36,7 +39,7 @@ def __init__(self,
if url_params is not None:
server_url = utils.template_url(server_url, url_params)

self.sdk_configuration = SDKConfiguration(client, security_client, server_url, server_idx)
self.sdk_configuration = SDKConfiguration(client, security_client, server_url, server_idx, retry_config=retry_config)

self._init_sdks()

Expand Down
7 changes: 5 additions & 2 deletions src/test/sdkconfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import requests
from dataclasses import dataclass

from .utils.retries import RetryConfig


SERVERS = [
'http://petstore.swagger.io/v1',
Expand All @@ -17,8 +19,9 @@ class SDKConfiguration:
server_idx: int = 0
language: str = 'python'
openapi_doc_version: str = '1.0.0'
sdk_version: str = '0.4.2'
gen_version: str = '2.96.3'
sdk_version: str = '0.4.3'
gen_version: str = '2.108.3'
retry_config: RetryConfig = None

def get_server_details(self) -> tuple[str, dict[str, str]]:
if self.server_url:
Expand Down
33 changes: 32 additions & 1 deletion src/test/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import re
from dataclasses import Field, dataclass, fields, is_dataclass, make_dataclass
from datetime import date, datetime
from decimal import Decimal
from email.message import Message
from enum import Enum
from typing import Any, Callable, Optional, Tuple, Union, get_args, get_origin
Expand Down Expand Up @@ -193,7 +194,7 @@ def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass
f"{pp_key},{_val_to_string(param[pp_key])}")
path = path.replace(
'{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1)
elif not isinstance(param, (str, int, float, complex, bool)):
elif not isinstance(param, (str, int, float, complex, bool, Decimal)):
pp_vals: list[str] = []
param_fields: Tuple[Field, ...] = fields(param)
for param_field in param_fields:
Expand Down Expand Up @@ -737,6 +738,36 @@ def datefromisoformat(date_str: str):
return dateutil.parser.parse(date_str).date()


def bigintencoder(optional: bool):
def bigintencode(val: int):
if optional and val is None:
return None
return str(val)

return bigintencode


def bigintdecoder(val):
return int(val)


def decimalencoder(optional: bool, as_str: bool):
def decimalencode(val: Decimal):
if optional and val is None:
return None

if as_str:
return str(val)

return float(val)

return decimalencode


def decimaldecoder(val):
return Decimal(str(val))


def get_field_name(name):
def override(_, _field_name=name):
return _field_name
Expand Down

0 comments on commit f70312d

Please sign in to comment.