Skip to content

Commit 0723b89

Browse files
authored
chore: Prep 0.9.0 release (#409)
1 parent cdc0d8c commit 0723b89

File tree

2 files changed

+51
-52
lines changed

2 files changed

+51
-52
lines changed

CHANGELOG.md

+50-51
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,33 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## 0.9.0
8+
9+
### Breaking Changes
10+
11+
- Some generated names will be different, solving some inconsistencies. (closes #369) (#375) Thanks @ramnes!
12+
- Change reference resolution to use reference path instead of class name (fixes #342) (#366)
13+
- If a schema references exactly one other schema in `allOf`, `oneOf`, or `anyOf` that referenced generated model will be used directly instead of generating a copy with another name. (#361)
14+
- Attributes shadowing any builtin except `id` and `type` will now be renamed in generated clients (#360, #378, #407). Thanks @dblanchette and @forest-benchling!
15+
16+
### Features
17+
18+
- Allow httpx 0.18.x in generated clients (#400)
19+
- Add summary attribute to Endpoint for use in custom templates (#404)
20+
- Support common parameters for paths (#376). Thanks @ramnes!
21+
- Add allOf support for model definitions (#98) (#321)
22+
23+
### Fixes
24+
25+
- Attempt to deduplicate endpoint parameters based on name and location (fixes #305) (#406)
26+
- Names of classes without titles will no longer include ref path (fixes #397) (#405). Thanks @ramnes!
27+
- Problems with enum defaults in allOf (#363). Thanks @csymeonides-mf
28+
- Prevent duplicate return types in generated api functions (#365)
29+
- Support empty strings in enums (closes #357) (#358). Thanks @ramnes!
30+
- Allow passing data with files in multipart. (Fixes #351) (#355)
31+
- Deserialization of unions (#332). Thanks @forest-benchling!
732

833
## 0.8.0 - 2021-02-19
934

@@ -14,10 +39,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1439
### Additions
1540

1641
- New `--meta` command line option for specifying what type of metadata should be generated:
42+
1743
- `poetry` is the default value, same behavior you're used to in previous versions
18-
- `setup` will generate a pyproject.toml with no Poetry information, and instead create a `setup.py` with the
19-
project info.
44+
- `setup` will generate a pyproject.toml with no Poetry information, and instead create a `setup.py` with the project info.
2045
- `none` will not create a project folder at all, only the inner package folder (which won't be inner anymore)
46+
2147
- Attempt to detect and alert users if they are using an unsupported version of OpenAPI (#281).
2248
- The media type application/vnd.api+json will now be handled just like application/json (#307). Thanks @jrversteegh!
2349
- Support passing models into query parameters (#316). Thanks @forest-benchling!
@@ -71,16 +97,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7197

7298
- Any request/response field that is not `required` and wasn't specified is now set to `UNSET` instead of `None`.
7399
- Values that are `UNSET` will not be sent along in API calls
74-
- Schemas defined with `type=object` will now be converted into classes, just like if they were created as ref components.
75-
The previous behavior was a combination of skipping and using generic Dicts for these schemas.
76-
- Response schema handling was unified with input schema handling, meaning that responses will behave differently than before.
77-
Specifically, instead of the content-type deciding what the generated Python type is, the schema itself will.
100+
- Schemas defined with `type=object` will now be converted into classes, just like if they were created as ref components. The previous behavior was a combination of skipping and using generic Dicts for these schemas.
101+
- Response schema handling was unified with input schema handling, meaning that responses will behave differently than before. Specifically, instead of the content-type deciding what the generated Python type is, the schema itself will.
102+
78103
- As a result of this, endpoints that used to return `bytes` when content-type was application/octet-stream will now return a `File` object if the type of the data is "binary", just like if you were submitting that type instead of receiving it.
104+
79105
- Instead of skipping input properties with no type, enum, anyOf, or oneOf declared, the property will be declared as `None`.
80-
- Class (models and Enums) names will now contain the name of their parent element (if any). For example, a property
81-
declared in an endpoint will be named like {endpoint*name}*{previous_class_name}. Classes will no longer be
82-
deduplicated by appending a number to the end of the generated name, so if two names conflict with this new naming
83-
scheme, there will be an error instead.
106+
- Class (models and Enums) names will now contain the name of their parent element (if any). For example, a property declared in an endpoint will be named like {endpoint*name}*{previous*class*name}. Classes will no longer be deduplicated by appending a number to the end of the generated name, so if two names conflict with this new naming scheme, there will be an error instead.
84107

85108
### Additions
86109

@@ -126,30 +149,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
126149

127150
### Breaking Changes
128151

129-
- Reorganized api calls in generated clients. `async_api` will no longer be generated. Each path operation will now
130-
have it's own module under its tag. For example, if there was a generated function `api.my_tag.my_function()` it is
131-
replaced with `api.my_tag.my_function.sync()`. The async version can be called with `asyncio()` instead of `sync()`.
132-
(#167)
133-
- Removed support for mutable default values (e.g. dicts, lists). They may be added back in a future version given enough
134-
demand, but the existing implementation was not up to this project's standards. (#170)
135-
- Removed generated `errors` module (and the `ApiResponseError` therein). Instead of raising an exception on failure,
136-
the `sync()` and `asyncio()` functions for a path operation will return `None`. This means all return types are now
137-
`Optional`, so mypy will require you to handle potential errors (or explicitly ignore them).
152+
- Reorganized api calls in generated clients. `async_api` will no longer be generated. Each path operation will now have it's own module under its tag. For example, if there was a generated function `api.my_tag.my_function()` it is replaced with `api.my_tag.my_function.sync()`. The async version can be called with `asyncio()` instead of `sync()`. (#167)
153+
- Removed support for mutable default values (e.g. dicts, lists). They may be added back in a future version given enough demand, but the existing implementation was not up to this project's standards. (#170)
154+
- Removed generated `errors` module (and the `ApiResponseError` therein). Instead of raising an exception on failure, the `sync()` and `asyncio()` functions for a path operation will return `None`. This means all return types are now `Optional`, so mypy will require you to handle potential errors (or explicitly ignore them).
138155
- Moved `models.types` generated module up a level, so just `types`.
139156
- All generated classes that were `dataclass` now use the `attrs` package instead
140157

141158
### Additions
142159

143-
- Every generated API module will have a `sync_detailed()` and `asyncio_detailed()` function which work like their
144-
non-detailed counterparts, but return a `types.Response[T]` instead of an `Optional[T]` (where T is the parsed body type).
145-
`types.Response` contains `status_code`, `content` (bytes of returned content), `headers`, and `parsed` (the
146-
parsed return type you would get from the non-detailed function). (#115)
147-
- It's now possible to include custom headers and cookies in requests, as well as set a custom timeout. This can be done
148-
either by directly setting those parameters on a `Client` (e.g. `my_client.headers = {"Header": "Value"}`) or using
149-
a fluid api (e.g. `my_endpoint.sync(my_client.with_cookies({"MyCookie": "cookie"}).with_timeout(10.0))`).
150-
- Unsupported content types or no responses at all will no longer result in an endpoint being completely skipped. Instead,
151-
only the `detailed` versions of the endpoint will be generated, where the resulting `Response.parsed` is always `None`.
152-
(#141)
160+
- Every generated API module will have a `sync_detailed()` and `asyncio_detailed()` function which work like their non-detailed counterparts, but return a `types.Response[T]` instead of an `Optional[T]` (where T is the parsed body type). `types.Response` contains `status_code`, `content` (bytes of returned content), `headers`, and `parsed` (the parsed return type you would get from the non-detailed function). (#115)
161+
- It's now possible to include custom headers and cookies in requests, as well as set a custom timeout. This can be done either by directly setting those parameters on a `Client` (e.g. `my_client.headers = {"Header": "Value"}`) or using a fluid api (e.g. `my_endpoint.sync(my_client.with_cookies({"MyCookie": "cookie"}).with_timeout(10.0))`).
162+
- Unsupported content types or no responses at all will no longer result in an endpoint being completely skipped. Instead, only the `detailed` versions of the endpoint will be generated, where the resulting `Response.parsed` is always `None`. (#141)
153163
- Support for Python 3.6 (#137 & #154)
154164
- Support for enums with integer values
155165

@@ -212,21 +222,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
212222

213223
### Changes
214224

215-
- When encountering a problem, the generator will now differentiate between warnings (things it was able to skip past)
216-
and errors (things which halt generation altogether).
225+
- When encountering a problem, the generator will now differentiate between warnings (things it was able to skip past) and errors (things which halt generation altogether).
217226

218227
### Additions
219228

220-
- The generator can now handle many more errors gracefully, skipping the things it can't generate and continuing
221-
with the pieces it can.
229+
- The generator can now handle many more errors gracefully, skipping the things it can't generate and continuing with the pieces it can.
222230
- Support for Enums declared in "components/schemas" and references to them (#102).
223231
- Generated clients can now be installed via pip (#120).
224232
- Support for YAML OpenAPI documents (#111)
225233

226234
### Internal Changes
227235

228-
- Switched OpenAPI document parsing to use Pydantic based on a vendored version of
229-
[openapi-schema-pydantic](https://github.com/kuimono/openapi-schema-pydantic/) (#103).
236+
- Switched OpenAPI document parsing to use Pydantic based on a vendored version of [openapi-schema-pydantic](https://github.com/kuimono/openapi-schema-pydantic/) (#103).
230237
- Tests can now be run on Windows.
231238

232239
## 0.4.2 - 2020-06-13
@@ -246,13 +253,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
246253

247254
### Breaking Changes
248255

249-
- Classes generated to be included within lists will now be named like <ListName>Item. For example, if a property
250-
named "statuses" is an array of enum values, previously the `Enum` class declared would be called "Statuses". Now it
251-
will be called "StatusesItem". If a "title" attribute was used in the OpenAPI document, that should still be respected
252-
and used instead of the generated name. You can restore previous names by adding "StatusesItem" to the `class_overrides`
253-
section of a config file.
254-
- Clients now require httpx ^0.13.0 (up from ^0.12.1). See [httpx release notes](https://github.com/encode/httpx/releases/tag/0.13.0)
255-
for details.
256+
- Classes generated to be included within lists will now be named like <ListName>Item. For example, if a property named "statuses" is an array of enum values, previously the `Enum` class declared would be called "Statuses". Now it will be called "StatusesItem". If a "title" attribute was used in the OpenAPI document, that should still be respected and used instead of the generated name. You can restore previous names by adding "StatusesItem" to the `class_overrides` section of a config file.
257+
- Clients now require httpx ^0.13.0 (up from ^0.12.1). See [httpx release notes](https://github.com/encode/httpx/releases/tag/0.13.0) for details.
256258

257259
### Additions
258260

@@ -261,24 +263,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
261263
- Support for any supported property within a list (array), including other lists.
262264
- Support for Union types ("anyOf" in OpenAPI document)
263265
- Support for more basic response types (integer, number, boolean)
264-
- Support for duplicate enums. Instead of erroring, enums with the same name (title) but differing values
265-
will have a number appended to the end. So if you have two conflicting enums named `MyEnum`, one of them
266-
will now be named `MyEnum1`. Note that the order in which these are processed and therefore named is entirely
267-
dependent on the order they are read from the OpenAPI document, so changes to the document could result
268-
in swapping the names of conflicting Enums.
266+
- Support for duplicate enums. Instead of erroring, enums with the same name (title) but differing values will have a number appended to the end. So if you have two conflicting enums named `MyEnum`, one of them will now be named `MyEnum1`. Note that the order in which these are processed and therefore named is entirely dependent on the order they are read from the OpenAPI document, so changes to the document could result in swapping the names of conflicting Enums.
269267

270268
### Changes
271269

272270
- The way most imports are handled was changed which _should_ lead to fewer unused imports in generated files.
273271
- Better error messages
272+
274273
- Most error messages will contain some useful information about why it failed instead of a stack trace
275274
- Client will still be generated if there are recoverable errors, excluding endpoints that had those errors
275+
276276
- Output from isort and black when generating will now be suppressed
277277

278278
### Fixes
279279

280-
- Defaults within models dataclasses for `Dict` or `List` properties will now be properly declared as a
281-
`field` with the `default_factory` parameter to prevent errors related to mutable defaults.
280+
- Defaults within models dataclasses for `Dict` or `List` properties will now be properly declared as a `field` with the `default_factory` parameter to prevent errors related to mutable defaults.
282281

283282
## 0.3.0 - 2020-04-25
284283

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "openapi-python-client"
3-
version = "0.8.0"
3+
version = "0.9.0"
44
description = "Generate modern Python clients from OpenAPI"
55
repository = "https://github.com/triaxtec/openapi-python-client"
66
license = "MIT"

0 commit comments

Comments
 (0)