Skip to content

Commit cff7e11

Browse files
authored
Merge branch 'main' into add-parseerror-detail
2 parents 8ed27da + 6245b18 commit cff7e11

File tree

22 files changed

+663
-72
lines changed

22 files changed

+663
-72
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:

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
## Creating a Pull Request
3434

35-
Once you've written the code and run the checks, the next step is to create a pull request against the `main` branch of this repository. This repository uses [conventional commits] squashed on each PR, then uses [Dobby] to auto-generate CHANGELOG.md entries for release. So the title of your PR should be in the format of a conventional commit written in plain english as it will end up in the CHANGELOG. Some example PR titles:
35+
Once you've written the code and run the checks, the next step is to create a pull request against the `main` branch of this repository. This repository uses [conventional commits] squashed on each PR, then uses [Knope] to auto-generate CHANGELOG.md entries for release. So the title of your PR should be in the format of a conventional commit written in plain english as it will end up in the CHANGELOG. Some example PR titles:
3636

3737
- feat: Support for `allOf` in OpenAPI documents (closes #123).
3838
- refactor!: Removed support for Python 3.5
@@ -45,4 +45,4 @@ Once your PR is created, a series of automated checks should run. If any of them
4545
As soon as possible, your PR will be reviewed. If there are any changes requested there will likely be a bit of back and forth. Once this process is done, your changes will be merged into main and included in the next release. If you need your changes available on PyPI by a certain time, please mention it in the PR, and we'll do our best to accommodate.
4646

4747
[Conventional Commits]: https://www.conventionalcommits.org/en/v1.0.0/
48-
[Dobby]: https://triaxtec.github.io/dobby/introduction.html
48+
[Knope]: https://knope-dev.github.io/knope/

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
@@ -3,6 +3,8 @@
33
import httpx
44

55
from ...client import Client
6+
from ...models.get_location_header_types_int_enum_header import GetLocationHeaderTypesIntEnumHeader
7+
from ...models.get_location_header_types_string_enum_header import GetLocationHeaderTypesStringEnumHeader
68
from ...types import UNSET, Response, Unset
79

810

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

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

38+
if not isinstance(int_enum_header, Unset):
39+
headers["Int-Enum-Header"] = str(int_enum_header)
40+
41+
if not isinstance(string_enum_header, Unset):
42+
headers["String-Enum-Header"] = str(string_enum_header)
43+
3444
return {
3545
"method": "get",
3646
"url": url,
@@ -56,13 +66,17 @@ def sync_detailed(
5666
string_header: Union[Unset, str] = UNSET,
5767
number_header: Union[Unset, float] = UNSET,
5868
integer_header: Union[Unset, int] = UNSET,
69+
int_enum_header: Union[Unset, GetLocationHeaderTypesIntEnumHeader] = UNSET,
70+
string_enum_header: Union[Unset, GetLocationHeaderTypesStringEnumHeader] = UNSET,
5971
) -> Response[Any]:
6072
"""
6173
Args:
6274
boolean_header (Union[Unset, bool]):
6375
string_header (Union[Unset, str]):
6476
number_header (Union[Unset, float]):
6577
integer_header (Union[Unset, int]):
78+
int_enum_header (Union[Unset, GetLocationHeaderTypesIntEnumHeader]):
79+
string_enum_header (Union[Unset, GetLocationHeaderTypesStringEnumHeader]):
6680
6781
Returns:
6882
Response[Any]
@@ -74,6 +88,8 @@ def sync_detailed(
7488
string_header=string_header,
7589
number_header=number_header,
7690
integer_header=integer_header,
91+
int_enum_header=int_enum_header,
92+
string_enum_header=string_enum_header,
7793
)
7894

7995
response = httpx.request(
@@ -91,13 +107,17 @@ async def asyncio_detailed(
91107
string_header: Union[Unset, str] = UNSET,
92108
number_header: Union[Unset, float] = UNSET,
93109
integer_header: Union[Unset, int] = UNSET,
110+
int_enum_header: Union[Unset, GetLocationHeaderTypesIntEnumHeader] = UNSET,
111+
string_enum_header: Union[Unset, GetLocationHeaderTypesStringEnumHeader] = UNSET,
94112
) -> Response[Any]:
95113
"""
96114
Args:
97115
boolean_header (Union[Unset, bool]):
98116
string_header (Union[Unset, str]):
99117
number_header (Union[Unset, float]):
100118
integer_header (Union[Unset, int]):
119+
int_enum_header (Union[Unset, GetLocationHeaderTypesIntEnumHeader]):
120+
string_enum_header (Union[Unset, GetLocationHeaderTypesStringEnumHeader]):
101121
102122
Returns:
103123
Response[Any]
@@ -109,6 +129,8 @@ async def asyncio_detailed(
109129
string_header=string_header,
110130
number_header=number_header,
111131
integer_header=integer_header,
132+
int_enum_header=int_enum_header,
133+
string_enum_header=string_enum_header,
112134
)
113135

114136
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
@@ -41,7 +41,7 @@ def sync_detailed(
4141
client: Client,
4242
form_data: AFormData,
4343
) -> Response[Any]:
44-
"""Post from data
44+
"""Post form data
4545
4646
Post form data
4747
@@ -67,7 +67,7 @@ async def asyncio_detailed(
6767
client: Client,
6868
form_data: AFormData,
6969
) -> Response[Any]:
70-
"""Post from data
70+
"""Post form data
7171
7272
Post form data
7373

0 commit comments

Comments
 (0)