Skip to content

Commit c3839bb

Browse files
authored
Merge branch 'main' into use-standard-error-codes
2 parents bd23f6a + ba1dbee commit c3839bb

File tree

26 files changed

+695
-79
lines changed

26 files changed

+695
-79
lines changed

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,8 @@ jobs:
1313
with:
1414
fetch-depth: 0
1515
token: ${{ secrets.PAT }}
16-
- uses: actions-rs/toolchain@v1
17-
with:
18-
profile: minimal
19-
toolchain: stable
20-
- uses: Swatinem/rust-cache@v1
2116
- name: Install Knope
22-
uses: actions-rs/cargo@v1
17+
uses: knope-dev/action@v1
2318
with:
24-
command: install
25-
args: knope
19+
version: 0.4.3
2620
- run: knope release --dry-run

.github/workflows/release.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,10 @@ jobs:
1717
git_user_signingkey: true
1818
git_commit_gpgsign: true
1919
git_push_gpgsign: false
20-
- uses: actions-rs/toolchain@v1
21-
with:
22-
profile: minimal
23-
toolchain: stable
24-
- uses: Swatinem/rust-cache@v1
2520
- name: Install Knope
26-
uses: actions-rs/cargo@v1
21+
uses: knope-dev/action@v1
2722
with:
28-
command: install
29-
args: knope
23+
version: 0.4.3
3024
- name: Bump Version & Create GitHub Release
3125
run: knope release
3226
env:

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ 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.11.6
17+
18+
### Features
19+
20+
- improve the error message when parsing a response fails [#659]. Thanks @supermihi!
21+
- Authorization header can now be customized in AuthenticatedClient [#660]. Thanks @supermihi!
22+
- Support inlined form data schema in requestBody [#656, #662]. Thanks @supermihi!
23+
- Allow enums in headers [#663, #667]. Thanks @supermihi!
24+
25+
### Fixes
26+
27+
- Exception when parsing documents which contain callbacks [#661]. Thanks @dachucky!
28+
1629
## 0.11.5
1730

1831
### Features

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import types
44

55
from . import (
6+
callback_test,
67
defaults_tests_defaults_post,
78
get_basic_list_of_booleans,
89
get_basic_list_of_floats,
@@ -14,6 +15,7 @@
1415
no_response_tests_no_response_get,
1516
octet_stream_tests_octet_stream_get,
1617
post_form_data,
18+
post_form_data_inline,
1719
post_tests_json_body_string,
1820
test_inline_objects,
1921
token_with_cookie_auth_token_with_cookie_get,
@@ -66,6 +68,13 @@ def post_form_data(cls) -> types.ModuleType:
6668
"""
6769
return post_form_data
6870

71+
@classmethod
72+
def post_form_data_inline(cls) -> types.ModuleType:
73+
"""
74+
Post form data (inline schema)
75+
"""
76+
return post_form_data_inline
77+
6978
@classmethod
7079
def upload_file_tests_upload_post(cls) -> types.ModuleType:
7180
"""
@@ -142,3 +151,10 @@ def token_with_cookie_auth_token_with_cookie_get(cls) -> types.ModuleType:
142151
Test optional cookie parameters
143152
"""
144153
return token_with_cookie_auth_token_with_cookie_get
154+
155+
@classmethod
156+
def callback_test(cls) -> types.ModuleType:
157+
"""
158+
Try sending a request related to a callback
159+
"""
160+
return callback_test

end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_header_types.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import httpx
55

66
from ...client import Client
7+
from ...models.get_location_header_types_int_enum_header import GetLocationHeaderTypesIntEnumHeader
8+
from ...models.get_location_header_types_string_enum_header import GetLocationHeaderTypesStringEnumHeader
79
from ...types import UNSET, Response, Unset
810

911

@@ -14,6 +16,8 @@ def _get_kwargs(
1416
string_header: Union[Unset, str] = UNSET,
1517
number_header: Union[Unset, float] = UNSET,
1618
integer_header: Union[Unset, int] = UNSET,
19+
int_enum_header: Union[Unset, GetLocationHeaderTypesIntEnumHeader] = UNSET,
20+
string_enum_header: Union[Unset, GetLocationHeaderTypesStringEnumHeader] = UNSET,
1721
) -> Dict[str, Any]:
1822
url = "{}/location/header/types".format(client.base_url)
1923

@@ -32,6 +36,12 @@ def _get_kwargs(
3236
if not isinstance(integer_header, Unset):
3337
headers["Integer-Header"] = str(integer_header)
3438

39+
if not isinstance(int_enum_header, Unset):
40+
headers["Int-Enum-Header"] = str(int_enum_header)
41+
42+
if not isinstance(string_enum_header, Unset):
43+
headers["String-Enum-Header"] = str(string_enum_header)
44+
3545
return {
3646
"method": "get",
3747
"url": url,
@@ -57,13 +67,17 @@ def sync_detailed(
5767
string_header: Union[Unset, str] = UNSET,
5868
number_header: Union[Unset, float] = UNSET,
5969
integer_header: Union[Unset, int] = UNSET,
70+
int_enum_header: Union[Unset, GetLocationHeaderTypesIntEnumHeader] = UNSET,
71+
string_enum_header: Union[Unset, GetLocationHeaderTypesStringEnumHeader] = UNSET,
6072
) -> Response[Any]:
6173
"""
6274
Args:
6375
boolean_header (Union[Unset, bool]):
6476
string_header (Union[Unset, str]):
6577
number_header (Union[Unset, float]):
6678
integer_header (Union[Unset, int]):
79+
int_enum_header (Union[Unset, GetLocationHeaderTypesIntEnumHeader]):
80+
string_enum_header (Union[Unset, GetLocationHeaderTypesStringEnumHeader]):
6781
6882
Returns:
6983
Response[Any]
@@ -75,6 +89,8 @@ def sync_detailed(
7589
string_header=string_header,
7690
number_header=number_header,
7791
integer_header=integer_header,
92+
int_enum_header=int_enum_header,
93+
string_enum_header=string_enum_header,
7894
)
7995

8096
response = httpx.request(
@@ -92,13 +108,17 @@ async def asyncio_detailed(
92108
string_header: Union[Unset, str] = UNSET,
93109
number_header: Union[Unset, float] = UNSET,
94110
integer_header: Union[Unset, int] = UNSET,
111+
int_enum_header: Union[Unset, GetLocationHeaderTypesIntEnumHeader] = UNSET,
112+
string_enum_header: Union[Unset, GetLocationHeaderTypesStringEnumHeader] = UNSET,
95113
) -> Response[Any]:
96114
"""
97115
Args:
98116
boolean_header (Union[Unset, bool]):
99117
string_header (Union[Unset, str]):
100118
number_header (Union[Unset, float]):
101119
integer_header (Union[Unset, int]):
120+
int_enum_header (Union[Unset, GetLocationHeaderTypesIntEnumHeader]):
121+
string_enum_header (Union[Unset, GetLocationHeaderTypesStringEnumHeader]):
102122
103123
Returns:
104124
Response[Any]
@@ -110,6 +130,8 @@ async def asyncio_detailed(
110130
string_header=string_header,
111131
number_header=number_header,
112132
integer_header=integer_header,
133+
int_enum_header=int_enum_header,
134+
string_enum_header=string_enum_header,
113135
)
114136

115137
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
from typing import Any, Dict, Optional, Union, cast
2+
3+
import httpx
4+
5+
from ...client import Client
6+
from ...models.a_model import AModel
7+
from ...models.http_validation_error import HTTPValidationError
8+
from ...types import Response
9+
10+
11+
def _get_kwargs(
12+
*,
13+
client: Client,
14+
json_body: AModel,
15+
) -> Dict[str, Any]:
16+
url = "{}/tests/callback".format(client.base_url)
17+
18+
headers: Dict[str, str] = client.get_headers()
19+
cookies: Dict[str, Any] = client.get_cookies()
20+
21+
json_json_body = json_body.to_dict()
22+
23+
return {
24+
"method": "post",
25+
"url": url,
26+
"headers": headers,
27+
"cookies": cookies,
28+
"timeout": client.get_timeout(),
29+
"json": json_json_body,
30+
}
31+
32+
33+
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
34+
if response.status_code == 200:
35+
response_200 = cast(Any, response.json())
36+
return response_200
37+
if response.status_code == 422:
38+
response_422 = HTTPValidationError.from_dict(response.json())
39+
40+
return response_422
41+
return None
42+
43+
44+
def _build_response(*, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
45+
return Response(
46+
status_code=response.status_code,
47+
content=response.content,
48+
headers=response.headers,
49+
parsed=_parse_response(response=response),
50+
)
51+
52+
53+
def sync_detailed(
54+
*,
55+
client: Client,
56+
json_body: AModel,
57+
) -> Response[Union[Any, HTTPValidationError]]:
58+
"""Path with callback
59+
60+
Try sending a request related to a callback
61+
62+
Args:
63+
json_body (AModel): A Model for testing all the ways custom objects can be used
64+
65+
Returns:
66+
Response[Union[Any, HTTPValidationError]]
67+
"""
68+
69+
kwargs = _get_kwargs(
70+
client=client,
71+
json_body=json_body,
72+
)
73+
74+
response = httpx.request(
75+
verify=client.verify_ssl,
76+
**kwargs,
77+
)
78+
79+
return _build_response(response=response)
80+
81+
82+
def sync(
83+
*,
84+
client: Client,
85+
json_body: AModel,
86+
) -> Optional[Union[Any, HTTPValidationError]]:
87+
"""Path with callback
88+
89+
Try sending a request related to a callback
90+
91+
Args:
92+
json_body (AModel): A Model for testing all the ways custom objects can be used
93+
94+
Returns:
95+
Response[Union[Any, HTTPValidationError]]
96+
"""
97+
98+
return sync_detailed(
99+
client=client,
100+
json_body=json_body,
101+
).parsed
102+
103+
104+
async def asyncio_detailed(
105+
*,
106+
client: Client,
107+
json_body: AModel,
108+
) -> Response[Union[Any, HTTPValidationError]]:
109+
"""Path with callback
110+
111+
Try sending a request related to a callback
112+
113+
Args:
114+
json_body (AModel): A Model for testing all the ways custom objects can be used
115+
116+
Returns:
117+
Response[Union[Any, HTTPValidationError]]
118+
"""
119+
120+
kwargs = _get_kwargs(
121+
client=client,
122+
json_body=json_body,
123+
)
124+
125+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
126+
response = await _client.request(**kwargs)
127+
128+
return _build_response(response=response)
129+
130+
131+
async def asyncio(
132+
*,
133+
client: Client,
134+
json_body: AModel,
135+
) -> Optional[Union[Any, HTTPValidationError]]:
136+
"""Path with callback
137+
138+
Try sending a request related to a callback
139+
140+
Args:
141+
json_body (AModel): A Model for testing all the ways custom objects can be used
142+
143+
Returns:
144+
Response[Union[Any, HTTPValidationError]]
145+
"""
146+
147+
return (
148+
await asyncio_detailed(
149+
client=client,
150+
json_body=json_body,
151+
)
152+
).parsed

end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def sync_detailed(
4242
client: Client,
4343
form_data: AFormData,
4444
) -> Response[Any]:
45-
"""Post from data
45+
"""Post form data
4646
4747
Post form data
4848
@@ -68,7 +68,7 @@ async def asyncio_detailed(
6868
client: Client,
6969
form_data: AFormData,
7070
) -> Response[Any]:
71-
"""Post from data
71+
"""Post form data
7272
7373
Post form data
7474

0 commit comments

Comments
 (0)