diff --git a/examples/petstore/client_async.py b/examples/petstore/client_async.py index 20c45b6..6df82b9 100644 --- a/examples/petstore/client_async.py +++ b/examples/petstore/client_async.py @@ -464,7 +464,7 @@ async def getPetById( auth: BasicAuth | None = None, content: str | bytes | None = None, headers: dict[str, Any] | None = None, - ) -> Pet | EmptyBody: + ) -> EmptyBody | Pet: url = self._get_url(f"/pet/{petId}") params = {} @@ -744,7 +744,7 @@ async def getUserByName( auth: BasicAuth | None = None, content: str | bytes | None = None, headers: dict[str, Any] | None = None, - ) -> User | EmptyBody: + ) -> EmptyBody | User: url = self._get_url(f"/user/{username}") params = {} @@ -811,7 +811,7 @@ async def addPet( auth: BasicAuth | None = None, content: str | bytes | None = None, headers: dict[str, Any] | None = None, - ) -> Pet | EmptyBody: + ) -> EmptyBody | Pet: url = self._get_url(f"/pet") params = {} @@ -880,7 +880,7 @@ async def addPet( auth: BasicAuth | None = None, content: str | bytes | None = None, headers: dict[str, Any] | None = None, - ) -> AddpetResponse200 | EmptyBody: + ) -> EmptyBody | AddpetResponse200: url = self._get_url(f"/pet_or_tag") params = {} @@ -1257,7 +1257,7 @@ async def updatePet( auth: BasicAuth | None = None, content: str | bytes | None = None, headers: dict[str, Any] | None = None, - ) -> Pet | EmptyBody: + ) -> EmptyBody | Pet: url = self._get_url(f"/pet") params = {} diff --git a/examples/petstore/client_sync.py b/examples/petstore/client_sync.py index 2011b19..8f6a42c 100644 --- a/examples/petstore/client_sync.py +++ b/examples/petstore/client_sync.py @@ -633,7 +633,7 @@ def loginUser( auth: BasicAuth | None = None, content: str | bytes | None = None, headers: dict[str, Any] | None = None, - ) -> LoginuserResponse200 | EmptyBody: + ) -> EmptyBody | LoginuserResponse200: url = self._get_url(f"/user/login") params = {} diff --git a/pyproject.toml b/pyproject.toml index b41e9a7..008188b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pythogen" -version = "0.1.32" +version = "0.1.33" description = "Generator of python HTTP-clients from OpenApi specification." homepage = "https://github.com/artsmolin/pythogen" repository = "https://github.com/artsmolin/pythogen" diff --git a/pythogen/models.py b/pythogen/models.py index 377a0b3..d82ff4b 100644 --- a/pythogen/models.py +++ b/pythogen/models.py @@ -72,7 +72,7 @@ class Format(Enum): def _missing_(cls, value): value = re.sub('[_-]*', '', value) for member in cls: - if member.lower() == value: + if member.name.lower() == value: return member return None diff --git a/tests/clients/async_client.py b/tests/clients/async_client.py index 584f10d..80fc7c1 100644 --- a/tests/clients/async_client.py +++ b/tests/clients/async_client.py @@ -579,7 +579,7 @@ async def get_object( auth: BasicAuth | None = None, content: str | bytes | None = None, headers: dict[str, Any] | None = None, - ) -> UnknownError | GetObjectResp: + ) -> GetObjectResp | UnknownError: url = self._get_url(f"/objects/{object_id}") params = { @@ -996,7 +996,7 @@ async def get_object_slow( auth: BasicAuth | None = None, content: str | bytes | None = None, headers: dict[str, Any] | None = None, - ) -> UnknownError | GetObjectResp: + ) -> GetObjectResp | UnknownError: url = self._get_url(f"/slow/objects/{object_id}") params = {} diff --git a/tests/clients/async_client_with_metrics.py b/tests/clients/async_client_with_metrics.py index e32cebb..555ffe0 100644 --- a/tests/clients/async_client_with_metrics.py +++ b/tests/clients/async_client_with_metrics.py @@ -660,7 +660,7 @@ async def get_object( auth: BasicAuth | None = None, content: str | bytes | None = None, headers: dict[str, Any] | None = None, - ) -> UnknownError | GetObjectResp: + ) -> GetObjectResp | UnknownError: url = self._get_url(f"/objects/{object_id}") params = { @@ -1239,7 +1239,7 @@ async def get_object_slow( auth: BasicAuth | None = None, content: str | bytes | None = None, headers: dict[str, Any] | None = None, - ) -> UnknownError | GetObjectResp: + ) -> GetObjectResp | UnknownError: url = self._get_url(f"/slow/objects/{object_id}") params = {} diff --git a/tests/clients/sync_client_with_metrics.py b/tests/clients/sync_client_with_metrics.py index 1445c6f..078f9d4 100644 --- a/tests/clients/sync_client_with_metrics.py +++ b/tests/clients/sync_client_with_metrics.py @@ -660,7 +660,7 @@ def get_object( auth: BasicAuth | None = None, content: str | bytes | None = None, headers: dict[str, Any] | None = None, - ) -> GetObjectResp | UnknownError: + ) -> UnknownError | GetObjectResp: url = self._get_url(f"/objects/{object_id}") params = { @@ -1239,7 +1239,7 @@ def get_object_slow( auth: BasicAuth | None = None, content: str | bytes | None = None, headers: dict[str, Any] | None = None, - ) -> GetObjectResp | UnknownError: + ) -> UnknownError | GetObjectResp: url = self._get_url(f"/slow/objects/{object_id}") params = {}