Generate modern Python clients from OpenAPI
MIT License
Bot releases are hidden (Show)
Published by dbanty over 3 years ago
Published by dbanty over 3 years ago
allOf
, oneOf
, or anyOf
that referenced generated model will be used directly instead of generating a copy with another name. (#361)id
and type
will now be renamed in generated clients (#360, #378, #407). Thanks @dblanchette and @forest-benchling!Published by dbanty over 3 years ago
None
to query parameters. Previously, any query params set to None
would surface as empty strings (per the default behavior of httpx
). This is contrary to the defaults indicated by the OpenAPI 3.0.3 spec. Ommitting these parameters makes us more compliant. If you require a style of null
to be passed to your query parameters, please request support for the OpenAPI "style" attribute. Thank you to @forest-benchling and @bowenwr for a ton of input on this.--meta
command line option for specifying what type of metadata should be generated:
poetry
is the default value, same behavior you're used to in previous versionssetup
will generate a pyproject.toml with no Poetry information, and instead create a setup.py
with thenone
will not create a project folder at all, only the inner package folder (which won't be inner anymore)--file-encoding
command line option (#330). Sets the encoding used when writing generated files (defaults to utf-8). Thanks @dongfangtianyu!python-dateutil
to 2.8.0 for improved compatibility (#298 & #299). Thanks @bowenwr!from_dict
method on generated models is now a @classmethod
instead of @staticmethod
(#215 & #292). Thanks @forest-benchling!.jinja
, and all python-templates to end in .py.jinja
to fix confusion with the latest version of mypy. Note this will break existing custom templates until you update your template file names.My Tag
and MyTag
are seen as two different tags but are then later unified, causing errors when creating directories. Thanks @p1-ra! (#328)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!None
and Unset
properties for all types by unifying the checks (#334). Thanks @forest-benchling!Enum
deserialization when the value is UNSET
(#306). Thanks @bowenwr!Published by dbanty almost 4 years ago
additionalProperties
(#266 & #268). Thanks @joshzana & @packyg!Published by dbanty almost 4 years ago
Published by dbanty almost 4 years ago
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!Published by dbanty almost 4 years ago
required
and wasn't specified is now set to UNSET
instead of None
.UNSET
will not be sent along in API callstype=object
will now be converted into classes, just like if they were created as ref components.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.None
.--custom-template-path
option for providing custom jinja2 templates (#231 - Thanks @erichulburd!).declare_type
param to transform
and initial_value
param to construct
to improve flexibility (#241 - Thanks @packyg!).Union
in generated models (#241 - Thanks @packyg!).Published by dbanty almost 4 years ago
Published by dbanty almost 4 years ago
declare_type
param to transform
and initial_value
param to construct
to improve flexibility (#241 - Thanks @packyg!).Union
in generated models (#241 - Thanks @packyg!).Published by dbanty almost 4 years ago
Fixed issue with non-required fields in a model not being marked as such
Published by dbanty almost 4 years ago
required
and wasn't specified is now set to UNSET
instead of None
.UNSET
will not be sent along in API callstype=object
will now be converted into classes, just like if they were created as ref components.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.None
.--custom-template-path
option for providing custom jinja2 templates (#231 - Thanks @erichulburd!).Published by dbanty almost 4 years ago
__init__.py
imports during generation. (#223 - Thanks @fyhertz!)package_version_override
in a config file. (#225 - Thanks @fyhertz!)Published by dbanty about 4 years ago
Published by dbanty about 4 years ago
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.
async_api
will no longer be generated. Each path operation will nowapi.my_tag.my_function()
it isapi.my_tag.my_function.sync()
. The async version can be called with asyncio()
instead of sync()
.errors
module (and the ApiResponseError
therein). Instead of raising an exception on failure,sync()
and asyncio()
functions for a path operation will return None
. This means all return types are nowOptional
, so mypy will require you to handle potential errors (or explicitly ignore them).models.types
generated module up a level, so just types
.dataclass
now use the attrs
package insteadsync_detailed()
and asyncio_detailed()
function which work like theirtypes.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
(theClient
(e.g. my_client.headers = {"Header": "Value"}
) or usingmy_endpoint.sync(my_client.with_cookies({"MyCookie": "cookie"}).with_timeout(10.0))
).detailed
versions of the endpoint will be generated, where the resulting Response.parsed
is always None
.Published by dbanty about 4 years ago
Changes since previous alpha
Published by dbanty about 4 years ago
Changes since last alpha
dataclass
now use the attrs
package insteadPublished by dbanty about 4 years ago
Only includes changes since 0.6.0-alpha.1
Optional
is now properly imported for nullable
fields (#177 & #180). Thanks @dtkav!Published by dbanty about 4 years ago
Optional
is now properly imported for nullable
fields (#177 & #180). Thanks @dtkav!Published by dbanty about 4 years ago
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)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).models.types
generated module up a level, so just types
.Client
and AuthenticatedClient
are now declared using the attrs
package instead of builtin dataclass
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)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))
).detailed
versions of the endpoint will be generated, where the resulting Response.parsed
is always None
. (#141)Published by dbanty about 4 years ago