Releases: openapi-generators/openapi-python-client
Releases · openapi-generators/openapi-python-client
0.7.2 - 2020-12-08
0.7.1 - 2020-12-08
Additions
- Support for additionalProperties attribute in OpenAPI schemas and "free-form" objects by adding an
additional_properties
attribute to generated models. COMPATIBILITY NOTE: this will prevent any model property with a name that would be coerced to "additional_properties" in the generated client from generating properly (#218 & #252). Thanks @packyg!
Fixes
0.7.0 - 2020-11-25
Breaking Changes
- Any request/response field that is not
required
and wasn't specified is now set toUNSET
instead ofNone
. - Values that are
UNSET
will not be sent along in API calls - 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. - 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.- As a result of this, endpoints that used to return
bytes
when content-type was application/octet-stream will now return aFile
object if the type of the data is "binary", just like if you were submitting that type instead of receiving it.
- As a result of this, endpoints that used to return
- Instead of skipping input properties with no type, enum, anyOf, or oneOf declared, the property will be declared as
None
. - 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.
Additions
- Added a
--custom-template-path
option for providing custom jinja2 templates (#231 - Thanks @erichulburd!). - Better compatibility for "required" (whether or not the field must be included) and "nullable" (whether or not the field can be null) (#205 & #208). Thanks @bowenwr & @emannguitar!
- Support for all the same schemas in responses as are supported in parameters.
- In template macros: added
declare_type
param totransform
andinitial_value
param toconstruct
to improve flexibility (#241 - Thanks @packyg!).
Fixes
0.7.0-rc.3 - 2020-11-24
0.7.0-rc.2
0.7.0-rc.1 - 2020-11-11
Fixed issue with non-required fields in a model not being marked as such
0.7.0-rc.0 - 2020-11-10
Breaking Changes
- Any request/response field that is not
required
and wasn't specified is now set toUNSET
instead ofNone
. - Values that are
UNSET
will not be sent along in API calls - 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. - 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.- As a result of this, endpoints that used to return
bytes
when content-type was application/octet-stream will now return aFile
object if the type of the data is "binary", just like if you were submitting that type instead of receiving it.
- As a result of this, endpoints that used to return
- Instead of skipping input properties with no type, enum, anyOf, or oneOf declared, the property will be declared as
None
. - 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.
Additions
- Added a
--custom-template-path
option for providing custom jinja2 templates (#231 - Thanks @erichulburd!). - Better compatibility for "required" (whether or not the field must be included) and "nullable" (whether or not the field can be null) (#205 & #208). Thanks @bowenwr & @emannguitar!
- Support for all the same schemas in responses as are supported in parameters.
0.6.2 - 2020-11-03
0.6.1 - 2020-09-26
Changes
- Use httpx ^0.15.0 in generated clients
Fixes
Additions
0.6.0 - 2020-09-21
This release is the culmination of a ton of feedback around the structure of generated clients. A huge thank you to everyone involved in making these improvements. That being said, clients generated with this release are not compatible with clients generated with 0.5.x. Use care when updating existing clients.
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 now
Optional
, so mypy will require you to handle potential errors (or explicitly ignore them). - Moved
models.types
generated module up a level, so justtypes
. - All generated classes that were
dataclass
now use theattrs
package instead
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 aClient
(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 thedetailed
versions of the endpoint will be generated, where the resultingResponse.parsed
is alwaysNone
.
(#141) - Support for Python 3.6 (#137 & #154)
- Support for enums with integer values
Changes
- The format of any errors/warnings has been spaced out a bit.