Skip to content

Commit 3da7245

Browse files
authored
Merge branch 'main' into follow_redirect
2 parents 3bb99c7 + 7af7323 commit 3da7245

File tree

20 files changed

+273
-53
lines changed

20 files changed

+273
-53
lines changed

.github/renovate.json

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,27 @@
33
"config:base",
44
":semanticCommitTypeAll(chore)"
55
],
6-
"rangeStrategy": "widen"
6+
"rangeStrategy": "widen",
7+
"regexManagers": [
8+
{
9+
"fileMatch": [
10+
"release.*\\.yml"
11+
],
12+
"matchStrings": [
13+
"version:\\s*(?<currentValue>.*)"
14+
],
15+
"depNameTemplate": "knope",
16+
"datasourceTemplate": "crate",
17+
"versioningTemplate": "semver"
18+
}
19+
],
20+
"packageRules": [
21+
{
22+
"packagePatterns": [
23+
"^knope$"
24+
],
25+
"groupName": "knope",
26+
"rangeStrategy": "pin"
27+
}
28+
]
729
}

.github/workflows/release-dry-run.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
- uses: actions/checkout@v3
1313
with:
1414
fetch-depth: 0
15-
token: ${{ secrets.PAT }}
15+
token: ${{ secrets.GITHUB_TOKEN }}
1616
- name: Install Knope
1717
uses: knope-dev/action@v1
1818
with:
19-
version: 0.6.2
19+
version: 0.7.2
2020
- run: knope release --dry-run

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Install Knope
2121
uses: knope-dev/action@v1
2222
with:
23-
version: 0.6.2
23+
version: 0.7.2
2424
- name: Bump Version & Create GitHub Release
2525
run: knope release
2626
env:

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ Programmatic usage of this project (e.g., importing it as a Python module) and t
1313

1414
The 0.x prefix used in versions for this project is to indicate that breaking changes are expected frequently (several times a year). Breaking changes will increment the minor number, all other changes will increment the patch number. You can track the progress toward 1.0 [here](https://github.com/openapi-generators/openapi-python-client/projects/2).
1515

16+
## 0.13.2
17+
18+
### Features
19+
20+
- Always generate enums with sorted members (#728)
21+
22+
### Fixes
23+
24+
- Prevent backslashes in descriptions from breaking docstrings [#735]. Thanks @robertschweizer & @bryan-hunt! (#735)
25+
- Respect `required` field in parameters included with `$ref` (#737)
26+
1627
## 0.13.1
1728

1829
### Features

end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/tests/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from . import (
66
callback_test,
77
defaults_tests_defaults_post,
8+
description_with_backslash,
89
get_basic_list_of_booleans,
910
get_basic_list_of_floats,
1011
get_basic_list_of_integers,
@@ -158,3 +159,10 @@ def callback_test(cls) -> types.ModuleType:
158159
Try sending a request related to a callback
159160
"""
160161
return callback_test
162+
163+
@classmethod
164+
def description_with_backslash(cls) -> types.ModuleType:
165+
"""
166+
Test description with \
167+
"""
168+
return description_with_backslash

end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Optional
2+
from typing import Any, Dict, Optional, Union
33

44
import httpx
55

66
from ... import errors
77
from ...client import Client
8-
from ...types import UNSET, Response
8+
from ...types import UNSET, Response, Unset
99

1010

1111
def _get_kwargs(
1212
path_param: str,
1313
*,
1414
client: Client,
15-
string_param: str,
16-
integer_param: int = 0,
17-
header_param: str,
18-
cookie_param: str,
15+
string_param: Union[Unset, None, str] = UNSET,
16+
integer_param: Union[Unset, None, int] = 0,
17+
header_param: Union[Unset, str] = UNSET,
18+
cookie_param: Union[Unset, str] = UNSET,
1919
) -> Dict[str, Any]:
2020
url = "{}/parameter-references/{path_param}".format(client.base_url, path_param=path_param)
2121

2222
headers: Dict[str, str] = client.get_headers()
2323
cookies: Dict[str, Any] = client.get_cookies()
2424

25-
headers["header param"] = header_param
25+
if not isinstance(header_param, Unset):
26+
headers["header param"] = header_param
2627

27-
cookies["cookie param"] = cookie_param
28+
if cookie_param is not UNSET:
29+
cookies["cookie param"] = cookie_param
2830

2931
params: Dict[str, Any] = {}
3032
params["string param"] = string_param
@@ -66,19 +68,19 @@ def sync_detailed(
6668
path_param: str,
6769
*,
6870
client: Client,
69-
string_param: str,
70-
integer_param: int = 0,
71-
header_param: str,
72-
cookie_param: str,
71+
string_param: Union[Unset, None, str] = UNSET,
72+
integer_param: Union[Unset, None, int] = 0,
73+
header_param: Union[Unset, str] = UNSET,
74+
cookie_param: Union[Unset, str] = UNSET,
7375
) -> Response[Any]:
7476
"""Test different types of parameter references
7577
7678
Args:
7779
path_param (str):
78-
string_param (str):
79-
integer_param (int):
80-
header_param (str):
81-
cookie_param (str):
80+
string_param (Union[Unset, None, str]):
81+
integer_param (Union[Unset, None, int]):
82+
header_param (Union[Unset, str]):
83+
cookie_param (Union[Unset, str]):
8284
8385
Raises:
8486
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -109,19 +111,19 @@ async def asyncio_detailed(
109111
path_param: str,
110112
*,
111113
client: Client,
112-
string_param: str,
113-
integer_param: int = 0,
114-
header_param: str,
115-
cookie_param: str,
114+
string_param: Union[Unset, None, str] = UNSET,
115+
integer_param: Union[Unset, None, int] = 0,
116+
header_param: Union[Unset, str] = UNSET,
117+
cookie_param: Union[Unset, str] = UNSET,
116118
) -> Response[Any]:
117119
"""Test different types of parameter references
118120
119121
Args:
120122
path_param (str):
121-
string_param (str):
122-
integer_param (int):
123-
header_param (str):
124-
cookie_param (str):
123+
string_param (Union[Unset, None, str]):
124+
integer_param (Union[Unset, None, int]):
125+
header_param (Union[Unset, str]):
126+
cookie_param (Union[Unset, str]):
125127
126128
Raises:
127129
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
from http import HTTPStatus
2+
from typing import Any, Dict, Optional
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import Client
8+
from ...types import Response
9+
10+
11+
def _get_kwargs(
12+
*,
13+
client: Client,
14+
) -> Dict[str, Any]:
15+
url = "{}/tests/description-with-backslash".format(client.base_url)
16+
17+
headers: Dict[str, str] = client.get_headers()
18+
cookies: Dict[str, Any] = client.get_cookies()
19+
20+
return {
21+
"method": "get",
22+
"url": url,
23+
"headers": headers,
24+
"cookies": cookies,
25+
"timeout": client.get_timeout(),
26+
}
27+
28+
29+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]:
30+
if response.status_code == HTTPStatus.OK:
31+
return None
32+
if client.raise_on_unexpected_status:
33+
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
34+
else:
35+
return None
36+
37+
38+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
39+
return Response(
40+
status_code=HTTPStatus(response.status_code),
41+
content=response.content,
42+
headers=response.headers,
43+
parsed=_parse_response(client=client, response=response),
44+
)
45+
46+
47+
def sync_detailed(
48+
*,
49+
client: Client,
50+
) -> Response[Any]:
51+
r""" Test description with \
52+
53+
Test description with \
54+
55+
Raises:
56+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
57+
httpx.TimeoutException: If the request takes longer than Client.timeout.
58+
59+
Returns:
60+
Response[Any]
61+
"""
62+
63+
kwargs = _get_kwargs(
64+
client=client,
65+
)
66+
67+
response = httpx.request(
68+
verify=client.verify_ssl,
69+
**kwargs,
70+
)
71+
72+
return _build_response(client=client, response=response)
73+
74+
75+
async def asyncio_detailed(
76+
*,
77+
client: Client,
78+
) -> Response[Any]:
79+
r""" Test description with \
80+
81+
Test description with \
82+
83+
Raises:
84+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
85+
httpx.TimeoutException: If the request takes longer than Client.timeout.
86+
87+
Returns:
88+
Response[Any]
89+
"""
90+
91+
kwargs = _get_kwargs(
92+
client=client,
93+
)
94+
95+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
96+
response = await _client.request(**kwargs)
97+
98+
return _build_response(client=client, response=response)

end_to_end_tests/golden-record/my_test_api_client/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
from .model_with_additional_properties_refed import ModelWithAdditionalPropertiesRefed
4848
from .model_with_any_json_properties import ModelWithAnyJsonProperties
4949
from .model_with_any_json_properties_additional_property_type_0 import ModelWithAnyJsonPropertiesAdditionalPropertyType0
50+
from .model_with_backslash_in_description import ModelWithBackslashInDescription
5051
from .model_with_circular_ref_a import ModelWithCircularRefA
5152
from .model_with_circular_ref_b import ModelWithCircularRefB
5253
from .model_with_circular_ref_in_additional_properties_a import ModelWithCircularRefInAdditionalPropertiesA
@@ -111,6 +112,7 @@
111112
"ModelWithAdditionalPropertiesRefed",
112113
"ModelWithAnyJsonProperties",
113114
"ModelWithAnyJsonPropertiesAdditionalPropertyType0",
115+
"ModelWithBackslashInDescription",
114116
"ModelWithCircularRefA",
115117
"ModelWithCircularRefB",
116118
"ModelWithCircularRefInAdditionalPropertiesA",

end_to_end_tests/golden-record/my_test_api_client/models/an_all_of_enum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33

44
class AnAllOfEnum(str, Enum):
5-
FOO = "foo"
6-
BAR = "bar"
75
A_DEFAULT = "a_default"
6+
BAR = "bar"
7+
FOO = "foo"
88
OVERRIDDEN_DEFAULT = "overridden_default"
99

1010
def __str__(self) -> str:

end_to_end_tests/golden-record/my_test_api_client/models/get_location_header_types_string_enum_header.py

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

44
class GetLocationHeaderTypesStringEnumHeader(str, Enum):
55
ONE = "one"
6-
TWO = "two"
76
THREE = "three"
7+
TWO = "two"
88

99
def __str__(self) -> str:
1010
return str(self.value)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from typing import Any, Dict, List, Type, TypeVar
2+
3+
import attr
4+
5+
T = TypeVar("T", bound="ModelWithBackslashInDescription")
6+
7+
8+
@attr.s(auto_attribs=True)
9+
class ModelWithBackslashInDescription:
10+
r""" Description with special character: \
11+
12+
"""
13+
14+
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
15+
16+
def to_dict(self) -> Dict[str, Any]:
17+
18+
field_dict: Dict[str, Any] = {}
19+
field_dict.update(self.additional_properties)
20+
field_dict.update({})
21+
22+
return field_dict
23+
24+
@classmethod
25+
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
26+
d = src_dict.copy()
27+
model_with_backslash_in_description = cls()
28+
29+
model_with_backslash_in_description.additional_properties = d
30+
return model_with_backslash_in_description
31+
32+
@property
33+
def additional_keys(self) -> List[str]:
34+
return list(self.additional_properties.keys())
35+
36+
def __getitem__(self, key: str) -> Any:
37+
return self.additional_properties[key]
38+
39+
def __setitem__(self, key: str, value: Any) -> None:
40+
self.additional_properties[key] = value
41+
42+
def __delitem__(self, key: str) -> None:
43+
del self.additional_properties[key]
44+
45+
def __contains__(self, key: str) -> bool:
46+
return key in self.additional_properties

0 commit comments

Comments
 (0)