Releases: openapi-generators/openapi-python-client
Releases · openapi-generators/openapi-python-client
0.5.4 - 2020-08-29
0.6.0-alpha.1
Breaking Changes
- 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 functionapi.my_tag.my_function()
it is replaced withapi.my_tag.my_function.sync()
. The async version can be called withasyncio()
instead ofsync()
. (#167) - 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)
- Removed generated
errors
module (and theApiResponseError
therein). Instead of raising an exception on failure, thesync()
andasyncio()
functions for a path operation will returnNone
. This means all return types are nowOptional
, so mypy will require you to handle potential errors (or explicitly ignore them). - Moved
models.types
generated module up a level, so justtypes
. Client
andAuthenticatedClient
are now declared using theattrs
package instead of builtindataclass
Additions
- Every generated API module will have a
sync_detailed()
andasyncio_detailed()
function which work like their non-detailed counterparts, but return atypes.Response[T]
instead of anOptional[T]
(where T is the parsed body type).types.Response
containsstatus_code
,content
(bytes of returned content),headers
, andparsed
(the parsed return type you would get from the non-detailed function). (#115) - 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))
). - 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 resultingResponse.parsed
is alwaysNone
. (#141)
Changes
- The format of any errors/warnings has been spaced out a bit.
0.5.3 - 2020-08-13
Security
- All values that become file/directory names are sanitized to address path traversal vulnerabilities (CVE-2020-15141)
- All values that get placed into python files (everything from enum names, to endpoint descriptions, to default values) are validated and/or saniziatied to address arbitrary code execution vulnerabilities (CVE-2020-15142)
Changes
- Due to security concerns/implementation complexities, default values are temporarily unsupported for any
RefProperty
that doesn't refer to an enum. - Defaults for properties must now be valid values for their respective type (e.g. "example string" is an invalid default for an
integer
type property, and the function for an endpoint using it would fail to generate and be skipped).
Additions
- Added support for header parameters (#117)
Fixes
0.5.2 - 2020-08-06
0.5.1 - 2020-08-05
0.5.0 - 2020-08-05
Changes
- 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).
Additions
- The generator can now handle many more errors gracefully, skipping the things it can't generate and continuing
with the pieces it can. - Support for Enums declared in "components/schemas" and references to them (#102).
- Generated clients can now be installed via pip (#120).
- Support for YAML OpenAPI documents (#111)
Internal Changes
- Switched OpenAPI document parsing to use Pydantic based on a vendored version of
openapi-schema-pydantic (#103). - Tests can now be run on Windows.
0.4.2 - 2020-06-13
0.4.1 - 2020-06-02
Additions
- Support for Python 3.7 (#58)
0.4.0 - 2020-05-30
Breaking Changes
- Classes generated to be included within lists will now be named like 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 theclass_overrides
section of a config file. - Clients now require httpx ^0.13.0 (up from ^0.12.1). See httpx release notes for details.
Additions
- Support for binary format strings (file payloads)
- Support for multipart/form bodies
- Support for any supported property within a list (array), including other lists.
- Support for Union types ("anyOf" in OpenAPI document)
- Support for more basic response types (integer, number, boolean)
- 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 namedMyEnum1
. 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.
Changes
- The way most imports are handled was changed which should lead to fewer unused imports in generated files.
- Better error messages
- Most error messages will contain some useful information about why it failed instead of a stack trace
- Client will still be generated if there are recoverable errors, excluding endpoints that had those errors
- Output from isort and black when generating will now be suppressed
Fixes
- Defaults within models dataclasses for
Dict
orList
properties will now be properly declared as afield
with thedefault_factory
parameter to prevent errors related to mutable defaults.