Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: internal
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

Fix failsafe deserialize for swagger generation
2 changes: 1 addition & 1 deletion packages/autorest.python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
"dependencies": {
"@typespec/http-client-python": "~0.19.1",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTQzNDg4MC9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.19.1.tgz",
"@autorest/system-requirements": "~1.0.2",
"fs-extra": "~11.2.0",
"tsx": "~4.19.1"
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize("duration", pipeline_response.http_response)
Expand Down Expand Up @@ -147,7 +150,10 @@ async def put_positive_duration(self, duration_body: datetime.timedelta, **kwarg

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down Expand Up @@ -189,7 +195,10 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize("duration", pipeline_response.http_response)
Expand Down Expand Up @@ -235,7 +244,10 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize("duration", pipeline_response.http_response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize("duration", pipeline_response.http_response)
Expand Down Expand Up @@ -205,7 +208,10 @@ def put_positive_duration( # pylint: disable=inconsistent-return-statements

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down Expand Up @@ -247,7 +253,10 @@ def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize("duration", pipeline_response.http_response)
Expand Down Expand Up @@ -293,7 +302,10 @@ def get_invalid(self, **kwargs: Any) -> datetime.timedelta:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize("duration", pipeline_response.http_response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ async def post_required(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down Expand Up @@ -177,7 +180,10 @@ async def post_optional(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down Expand Up @@ -237,7 +243,10 @@ async def post_reserved_words(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down Expand Up @@ -307,7 +316,10 @@ async def post_multi_param_groups(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down Expand Up @@ -361,7 +373,10 @@ async def post_shared_parameter_group_object(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down Expand Up @@ -414,7 +429,10 @@ async def group_with_constant(self, grouper: Optional[_models.Grouper] = None, *

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,10 @@ def post_required( # pylint: disable=inconsistent-return-statements

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down Expand Up @@ -321,7 +324,10 @@ def post_optional( # pylint: disable=inconsistent-return-statements

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down Expand Up @@ -381,7 +387,10 @@ def post_reserved_words( # pylint: disable=inconsistent-return-statements

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down Expand Up @@ -451,7 +460,10 @@ def post_multi_param_groups( # pylint: disable=inconsistent-return-statements

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down Expand Up @@ -505,7 +517,10 @@ def post_shared_parameter_group_object( # pylint: disable=inconsistent-return-s

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down Expand Up @@ -560,7 +575,10 @@ def group_with_constant( # pylint: disable=inconsistent-return-statements

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ async def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> di

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize("{int}", pipeline_response.http_response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> dict[str

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize("{int}", pipeline_response.http_response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ async def get_method_global_valid(self, **kwargs: Any) -> None:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

if cls:
Expand Down Expand Up @@ -141,7 +144,10 @@ async def get_method_global_not_provided_valid(self, **kwargs: Any) -> None:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

if cls:
Expand Down Expand Up @@ -185,7 +191,10 @@ async def get_path_global_valid(self, **kwargs: Any) -> None:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

if cls:
Expand Down Expand Up @@ -229,7 +238,10 @@ async def get_swagger_global_valid(self, **kwargs: Any) -> None:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

if cls:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ async def get_method_local_valid(self, **kwargs: Any) -> None:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

if cls:
Expand Down Expand Up @@ -143,7 +146,10 @@ async def get_method_local_null(self, api_version: Optional[str] = None, **kwarg

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

if cls:
Expand Down Expand Up @@ -187,7 +193,10 @@ async def get_path_local_valid(self, **kwargs: Any) -> None:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

if cls:
Expand Down Expand Up @@ -231,7 +240,10 @@ async def get_swagger_local_valid(self, **kwargs: Any) -> None:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response)
error = self._deserialize.failsafe_deserialize(
_models.Error,
pipeline_response,
)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

if cls:
Expand Down
Loading
Loading