You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR was created by Knope. Merging it will create a new release
### Breaking Changes
#### Removed query parameter nullable/required special case
In previous versions, setting _either_ `nullable: true` or `required:
false` on a query parameter would act like both were set, resulting in a
type signature like `Union[None, Unset, YourType]`. This special case
has been removed, query parameters will now act like all other types of
parameters.
#### Renamed body types and parameters
PR #900 addresses #822.
Where previously there would be one body parameter per supported content
type, now there is a single `body` parameter which takes a union of all
the possible inputs. This correctly models the fact that only one body
can be sent (and ever would be sent) in a request.
For example, when calling a generated endpoint, code which used to look
like this:
```python
post_body_multipart.sync_detailed(
client=client,
multipart_data=PostBodyMultipartMultipartData(),
)
```
Will now look like this:
```python
post_body_multipart.sync_detailed(
client=client,
body=PostBodyMultipartBody(),
)
```
Note that both the input parameter name _and_ the class name have
changed. This should result in simpler code when there is only a single
body type and now produces correct code when there are multiple body
types.
### Features
#### OpenAPI 3.1 support
The generator will now attempt to generate code for OpenAPI documents
with versions 3.1.x (previously, it would exit immediately on seeing a
version other than 3.0.x). The following specific OpenAPI 3.1 features
are now supported:
- `null` as a type
- Arrays of types (e.g., `type: [string, null]`)
- `const` (defines `Literal` types)
The generator does not currently validate that the OpenAPI document is
valid for a specific version of OpenAPI, so it may be possible to
generate code for documents that include both removed 3.0 syntax (e.g.,
`nullable`) and new 3.1 syntax (e.g., `null` as a type).
Thanks to everyone who helped make this possible with discussions and
testing, including:
- @frco9
- @vogre
- @naddeoa
- @staticdev
- @philsturgeon
- @johnthagen
#### Support multiple possible `requestBody`
PR #900 addresses #822.
It is now possible in some circumstances to generate valid code for
OpenAPI documents which have multiple possible `requestBody` values.
Previously, invalid code could have been generated with no warning (only
one body could actually be sent).
Only one content type per "category" is currently supported at a time.
The categories are:
- JSON, like `application/json`
- Binary data, like `application/octet-stream`
- Encoded form data, like `application/x-www-form-urlencoded`
- Files, like `multipart/form-data`
### Fixes
#### Always use correct content type for requests
In previous versions, a request body that was similar to a known content
type would use that content type in the request. For example
`application/json` would be used for `application/vnd.api+json`. This
was incorrect and could result in invalid requests being sent.
Now, the content type defined in the OpenAPI document will always be
used.
Co-authored-by: GitHub <[email protected]>
Copy file name to clipboardexpand all lines: CHANGELOG.md
+76
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,82 @@ Programmatic usage of this project (e.g., importing it as a Python module) and t
13
13
14
14
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).
15
15
16
+
## 0.17.0 (2023-12-31)
17
+
18
+
### Breaking Changes
19
+
20
+
#### Removed query parameter nullable/required special case
21
+
22
+
In previous versions, setting _either_`nullable: true` or `required: false` on a query parameter would act like both were set, resulting in a type signature like `Union[None, Unset, YourType]`. This special case has been removed, query parameters will now act like all other types of parameters.
23
+
24
+
#### Renamed body types and parameters
25
+
26
+
PR #900 addresses #822.
27
+
28
+
Where previously there would be one body parameter per supported content type, now there is a single `body` parameter which takes a union of all the possible inputs. This correctly models the fact that only one body can be sent (and ever would be sent) in a request.
29
+
30
+
For example, when calling a generated endpoint, code which used to look like this:
31
+
32
+
```python
33
+
post_body_multipart.sync_detailed(
34
+
client=client,
35
+
multipart_data=PostBodyMultipartMultipartData(),
36
+
)
37
+
```
38
+
39
+
Will now look like this:
40
+
41
+
```python
42
+
post_body_multipart.sync_detailed(
43
+
client=client,
44
+
body=PostBodyMultipartBody(),
45
+
)
46
+
```
47
+
48
+
Note that both the input parameter name _and_ the class name have changed. This should result in simpler code when there is only a single body type and now produces correct code when there are multiple body types.
49
+
50
+
### Features
51
+
52
+
#### OpenAPI 3.1 support
53
+
54
+
The generator will now attempt to generate code for OpenAPI documents with versions 3.1.x (previously, it would exit immediately on seeing a version other than 3.0.x). The following specific OpenAPI 3.1 features are now supported:
55
+
56
+
-`null` as a type
57
+
- Arrays of types (e.g., `type: [string, null]`)
58
+
-`const` (defines `Literal` types)
59
+
60
+
The generator does not currently validate that the OpenAPI document is valid for a specific version of OpenAPI, so it may be possible to generate code for documents that include both removed 3.0 syntax (e.g., `nullable`) and new 3.1 syntax (e.g., `null` as a type).
61
+
62
+
Thanks to everyone who helped make this possible with discussions and testing, including:
63
+
64
+
-@frco9
65
+
-@vogre
66
+
-@naddeoa
67
+
-@staticdev
68
+
-@philsturgeon
69
+
-@johnthagen
70
+
71
+
#### Support multiple possible `requestBody`
72
+
73
+
PR #900 addresses #822.
74
+
75
+
It is now possible in some circumstances to generate valid code for OpenAPI documents which have multiple possible `requestBody` values. Previously, invalid code could have been generated with no warning (only one body could actually be sent).
76
+
77
+
Only one content type per "category" is currently supported at a time. The categories are:
78
+
79
+
- JSON, like `application/json`
80
+
- Binary data, like `application/octet-stream`
81
+
- Encoded form data, like `application/x-www-form-urlencoded`
82
+
- Files, like `multipart/form-data`
83
+
84
+
### Fixes
85
+
86
+
#### Always use correct content type for requests
87
+
88
+
In previous versions, a request body that was similar to a known content type would use that content type in the request. For example `application/json` would be used for `application/vnd.api+json`. This was incorrect and could result in invalid requests being sent.
89
+
90
+
Now, the content type defined in the OpenAPI document will always be used.
0 commit comments