Skip to content

Commit 39faebf

Browse files
Merge remote-tracking branch 'upstream/main' into forest-union-3
2 parents 682c5ab + d98e349 commit 39faebf

32 files changed

+475
-91
lines changed

CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## 0.8.0 - Unreleased
8+
## 0.8.0 - 2021-02-19
99

1010
### Breaking Changes
1111

@@ -19,9 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
project info.
2020
- `none` will not create a project folder at all, only the inner package folder (which won't be inner anymore)
2121
- Attempt to detect and alert users if they are using an unsupported version of OpenAPI (#281).
22-
- Fixes `Enum` deserialization when the value is `UNSET`.
23-
- Add handling of application/vnd.api+json media type.
22+
- The media type application/vnd.api+json will now be handled just like application/json (#307). Thanks @jrversteegh!
2423
- Support passing models into query parameters (#316). Thanks @forest-benchling!
24+
- Add support for cookie parameters (#326).
25+
- New `--file-encoding` command line option (#330). Sets the encoding used when writing generated files (defaults to utf-8). Thanks @dongfangtianyu!
2526

2627
### Changes
2728

@@ -31,10 +32,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3132

3233
### Fixes
3334

35+
- Endpoint tags are now sanitized during parsing to fix an issue where `My Tag` and `MyTag` are seen as two different tags but are then later unified, causing errors when creating directories. Thanks @p1-ra! (#328)
3436
- Parser will softly ignore value error during schema responses' status code convertion from string to integer (not a number). Errors will be reported to the end user and parsing will continue to proceed (#327).
3537
- The generated `from_dict` and `to_dict` methods of models will now properly handle `nullable` and `not required` properties that are themselves generated models (#315). Thanks @forest-benchling!
38+
- Fixed a typo in the async example in generated README.md files (#337). Thanks @synchronizing!
3639
- Fix deserialization of `None` and `Unset` properties for all types by unifying the checks (#334). Thanks @forest-benchling!
3740
- If duplicate model names are detected during generation, you'll now get an error message instead of broken code (#336). Thanks @forest-benchling!
41+
- Fixes `Enum` deserialization when the value is `UNSET` (#306). Thanks @bowenwr!
3842

3943
## 0.7.3 - 2020-12-21
4044

end_to_end_tests/golden-record-custom/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Or do the same thing with an async version:
3434

3535
```python
3636
from custom_e2e.models import MyDataModel
37-
from custom_e2e.async_api.my_tag import get_my_data_model
37+
from custom_e2e.api.my_tag import get_my_data_model
3838
from custom_e2e.types import Response
3939

4040
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from typing import Optional
2+
3+
import httpx
4+
5+
from ...types import Response
6+
7+
Client = httpx.Client
8+
9+
10+
def _parse_response(*, response: httpx.Response) -> Optional[Union[None, None]]:
11+
if response.status_code == 200:
12+
response_200 = None
13+
14+
return response_200
15+
if response.status_code == 401:
16+
response_401 = None
17+
18+
return response_401
19+
return None
20+
21+
22+
def _build_response(*, response: httpx.Response) -> Response[Union[None, None]]:
23+
return Response(
24+
status_code=response.status_code,
25+
content=response.content,
26+
headers=response.headers,
27+
parsed=_parse_response(response=response),
28+
)
29+
30+
31+
def httpx_request(
32+
*,
33+
client: Client,
34+
my_token: str,
35+
) -> Response[Union[None, None]]:
36+
37+
response = client.request(
38+
"get",
39+
"/auth/token_with_cookie",
40+
)
41+
42+
return _build_response(response=response)

end_to_end_tests/golden-record/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Or do the same thing with an async version:
3434

3535
```python
3636
from my_test_api_client.models import MyDataModel
37-
from my_test_api_client.async_api.my_tag import get_my_data_model
37+
from my_test_api_client.api.my_tag import get_my_data_model
3838
from my_test_api_client.types import Response
3939

4040
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def _get_kwargs(
3535
url = "{}/tests/defaults".format(client.base_url)
3636

3737
headers: Dict[str, Any] = client.get_headers()
38+
cookies: Dict[str, Any] = client.get_cookies()
3839

3940
json_not_required_not_nullable_datetime_prop: Union[Unset, str] = UNSET
4041
if not isinstance(not_required_not_nullable_datetime_prop, Unset):
@@ -132,7 +133,7 @@ def _get_kwargs(
132133
return {
133134
"url": url,
134135
"headers": headers,
135-
"cookies": client.get_cookies(),
136+
"cookies": cookies,
136137
"timeout": client.get_timeout(),
137138
"params": params,
138139
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ def _get_kwargs(
1313
url = "{}/tests/basic_lists/booleans".format(client.base_url)
1414

1515
headers: Dict[str, Any] = client.get_headers()
16+
cookies: Dict[str, Any] = client.get_cookies()
1617

1718
return {
1819
"url": url,
1920
"headers": headers,
20-
"cookies": client.get_cookies(),
21+
"cookies": cookies,
2122
"timeout": client.get_timeout(),
2223
}
2324

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ def _get_kwargs(
1313
url = "{}/tests/basic_lists/floats".format(client.base_url)
1414

1515
headers: Dict[str, Any] = client.get_headers()
16+
cookies: Dict[str, Any] = client.get_cookies()
1617

1718
return {
1819
"url": url,
1920
"headers": headers,
20-
"cookies": client.get_cookies(),
21+
"cookies": cookies,
2122
"timeout": client.get_timeout(),
2223
}
2324

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ def _get_kwargs(
1313
url = "{}/tests/basic_lists/integers".format(client.base_url)
1414

1515
headers: Dict[str, Any] = client.get_headers()
16+
cookies: Dict[str, Any] = client.get_cookies()
1617

1718
return {
1819
"url": url,
1920
"headers": headers,
20-
"cookies": client.get_cookies(),
21+
"cookies": cookies,
2122
"timeout": client.get_timeout(),
2223
}
2324

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ def _get_kwargs(
1313
url = "{}/tests/basic_lists/strings".format(client.base_url)
1414

1515
headers: Dict[str, Any] = client.get_headers()
16+
cookies: Dict[str, Any] = client.get_cookies()
1617

1718
return {
1819
"url": url,
1920
"headers": headers,
20-
"cookies": client.get_cookies(),
21+
"cookies": cookies,
2122
"timeout": client.get_timeout(),
2223
}
2324

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def _get_kwargs(
1919
url = "{}/tests/".format(client.base_url)
2020

2121
headers: Dict[str, Any] = client.get_headers()
22+
cookies: Dict[str, Any] = client.get_cookies()
2223

2324
json_an_enum_value = []
2425
for an_enum_value_item_data in an_enum_value:
@@ -40,7 +41,7 @@ def _get_kwargs(
4041
return {
4142
"url": url,
4243
"headers": headers,
43-
"cookies": client.get_cookies(),
44+
"cookies": cookies,
4445
"timeout": client.get_timeout(),
4546
"params": params,
4647
}

0 commit comments

Comments
 (0)