Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .chronus/changes/main-2025-7-18-15-23-57.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@azure-tools/typespec-python"
---

Add testcases for several spector scenarios
5 changes: 4 additions & 1 deletion packages/typespec-python/scripts/eng/regenerate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ const AZURE_EMITTER_OPTIONS: Record<string, Record<string, string> | Record<stri
"namespace": "client.structure.twooperationgroup",
},
"client/naming": {
namespace: "client.naming",
namespace: "client.naming.main",
},
"client/naming/enum-conflict": {
namespace: "client.naming.enumconflict",
},
"client/overload": {
namespace: "client.overload",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"CrossLanguagePackageId": "Client.Naming.EnumConflict",
"CrossLanguageDefinitionId": {
"client.naming.enumconflict.firstnamespace.models.FirstModel": "Client.Naming.EnumConflict.FirstNamespace.FirstModel",
"client.naming.enumconflict.secondnamespace.models.SecondModel": "Client.Naming.EnumConflict.SecondNamespace.SecondModel",
"client.naming.enumconflict.models.FirstModel": "Client.Naming.EnumConflict.FirstNamespace.FirstModel",
"client.naming.enumconflict.models.SecondModel": "Client.Naming.EnumConflict.SecondNamespace.SecondModel",
"client.naming.enumconflict.models.Status": "Client.Naming.EnumConflict.FirstNamespace.Status",
"client.naming.enumconflict.models.SecondStatus": "Client.Naming.EnumConflict.SecondNamespace.Status",
"client.naming.enumconflict.operations.FirstOperationsOperations.first": "Client.Naming.EnumConflict.FirstOperations.first",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=line-too-long
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=line-too-long,useless-suppression
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down Expand Up @@ -26,11 +27,10 @@
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict

from ... import models as _models
from ..._utils.model_base import SdkJSONEncoder, _deserialize
from ..._utils.serialization import Deserializer, Serializer
from ...firstnamespace import models as _firstnamespace_models3
from ...operations._operations import build_first_operations_first_request, build_second_operations_second_request
from ...secondnamespace import models as _secondnamespace_models3
from .._configuration import EnumConflictClientConfiguration

JSON = MutableMapping[str, Any]
Expand All @@ -57,24 +57,22 @@ def __init__(self, *args, **kwargs) -> None:

@overload
async def first(
self, body: _firstnamespace_models3.FirstModel, *, content_type: str = "application/json", **kwargs: Any
) -> _firstnamespace_models3.FirstModel:
self, body: _models.FirstModel, *, content_type: str = "application/json", **kwargs: Any
) -> _models.FirstModel:
"""Operation using first namespace Status enum.

:param body: Required.
:type body: ~client.naming.enumconflict.firstnamespace.models.FirstModel
:type body: ~client.naming.enumconflict.models.FirstModel
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: FirstModel. The FirstModel is compatible with MutableMapping
:rtype: ~client.naming.enumconflict.firstnamespace.models.FirstModel
:rtype: ~client.naming.enumconflict.models.FirstModel
:raises ~azure.core.exceptions.HttpResponseError:
"""

@overload
async def first(
self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
) -> _firstnamespace_models3.FirstModel:
async def first(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.FirstModel:
"""Operation using first namespace Status enum.

:param body: Required.
Expand All @@ -83,14 +81,14 @@ async def first(
Default value is "application/json".
:paramtype content_type: str
:return: FirstModel. The FirstModel is compatible with MutableMapping
:rtype: ~client.naming.enumconflict.firstnamespace.models.FirstModel
:rtype: ~client.naming.enumconflict.models.FirstModel
:raises ~azure.core.exceptions.HttpResponseError:
"""

@overload
async def first(
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _firstnamespace_models3.FirstModel:
) -> _models.FirstModel:
"""Operation using first namespace Status enum.

:param body: Required.
Expand All @@ -99,20 +97,18 @@ async def first(
Default value is "application/json".
:paramtype content_type: str
:return: FirstModel. The FirstModel is compatible with MutableMapping
:rtype: ~client.naming.enumconflict.firstnamespace.models.FirstModel
:rtype: ~client.naming.enumconflict.models.FirstModel
:raises ~azure.core.exceptions.HttpResponseError:
"""

@distributed_trace_async
async def first(
self, body: Union[_firstnamespace_models3.FirstModel, JSON, IO[bytes]], **kwargs: Any
) -> _firstnamespace_models3.FirstModel:
async def first(self, body: Union[_models.FirstModel, JSON, IO[bytes]], **kwargs: Any) -> _models.FirstModel:
"""Operation using first namespace Status enum.

:param body: Is one of the following types: FirstModel, JSON, IO[bytes] Required.
:type body: ~client.naming.enumconflict.firstnamespace.models.FirstModel or JSON or IO[bytes]
:type body: ~client.naming.enumconflict.models.FirstModel or JSON or IO[bytes]
:return: FirstModel. The FirstModel is compatible with MutableMapping
:rtype: ~client.naming.enumconflict.firstnamespace.models.FirstModel
:rtype: ~client.naming.enumconflict.models.FirstModel
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
Expand All @@ -127,7 +123,7 @@ async def first(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_firstnamespace_models3.FirstModel] = kwargs.pop("cls", None)
cls: ClsType[_models.FirstModel] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
_content = None
Expand Down Expand Up @@ -166,7 +162,7 @@ async def first(
if _stream:
deserialized = response.iter_bytes()
else:
deserialized = _deserialize(_firstnamespace_models3.FirstModel, response.json())
deserialized = _deserialize(_models.FirstModel, response.json())

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
Expand All @@ -193,24 +189,22 @@ def __init__(self, *args, **kwargs) -> None:

@overload
async def second(
self, body: _secondnamespace_models3.SecondModel, *, content_type: str = "application/json", **kwargs: Any
) -> _secondnamespace_models3.SecondModel:
self, body: _models.SecondModel, *, content_type: str = "application/json", **kwargs: Any
) -> _models.SecondModel:
"""Operation using second namespace Status enum.

:param body: Required.
:type body: ~client.naming.enumconflict.secondnamespace.models.SecondModel
:type body: ~client.naming.enumconflict.models.SecondModel
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: SecondModel. The SecondModel is compatible with MutableMapping
:rtype: ~client.naming.enumconflict.secondnamespace.models.SecondModel
:rtype: ~client.naming.enumconflict.models.SecondModel
:raises ~azure.core.exceptions.HttpResponseError:
"""

@overload
async def second(
self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
) -> _secondnamespace_models3.SecondModel:
async def second(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.SecondModel:
"""Operation using second namespace Status enum.

:param body: Required.
Expand All @@ -219,14 +213,14 @@ async def second(
Default value is "application/json".
:paramtype content_type: str
:return: SecondModel. The SecondModel is compatible with MutableMapping
:rtype: ~client.naming.enumconflict.secondnamespace.models.SecondModel
:rtype: ~client.naming.enumconflict.models.SecondModel
:raises ~azure.core.exceptions.HttpResponseError:
"""

@overload
async def second(
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _secondnamespace_models3.SecondModel:
) -> _models.SecondModel:
"""Operation using second namespace Status enum.

:param body: Required.
Expand All @@ -235,20 +229,18 @@ async def second(
Default value is "application/json".
:paramtype content_type: str
:return: SecondModel. The SecondModel is compatible with MutableMapping
:rtype: ~client.naming.enumconflict.secondnamespace.models.SecondModel
:rtype: ~client.naming.enumconflict.models.SecondModel
:raises ~azure.core.exceptions.HttpResponseError:
"""

@distributed_trace_async
async def second(
self, body: Union[_secondnamespace_models3.SecondModel, JSON, IO[bytes]], **kwargs: Any
) -> _secondnamespace_models3.SecondModel:
async def second(self, body: Union[_models.SecondModel, JSON, IO[bytes]], **kwargs: Any) -> _models.SecondModel:
"""Operation using second namespace Status enum.

:param body: Is one of the following types: SecondModel, JSON, IO[bytes] Required.
:type body: ~client.naming.enumconflict.secondnamespace.models.SecondModel or JSON or IO[bytes]
:type body: ~client.naming.enumconflict.models.SecondModel or JSON or IO[bytes]
:return: SecondModel. The SecondModel is compatible with MutableMapping
:rtype: ~client.naming.enumconflict.secondnamespace.models.SecondModel
:rtype: ~client.naming.enumconflict.models.SecondModel
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
Expand All @@ -263,7 +255,7 @@ async def second(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_secondnamespace_models3.SecondModel] = kwargs.pop("cls", None)
cls: ClsType[_models.SecondModel] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
_content = None
Expand Down Expand Up @@ -302,7 +294,7 @@ async def second(
if _stream:
deserialized = response.iter_bytes()
else:
deserialized = _deserialize(_secondnamespace_models3.SecondModel, response.json())
deserialized = _deserialize(_models.SecondModel, response.json())

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading