Skip to content

Commit 2d11a15

Browse files
authored
[python] correctly cache enum members (#3322)
* Update dependencies * Add changelog * Update dependencies (2026-01-30 00:57:31) * Regenerate for typespec-python (2026-01-30 01:03:16) * Regenerate for autorest.python (2026-01-30 01:18:03) --------- Co-authored-by: AutoPrFromHttpClientPython <AutoPrFromHttpClientPython>
1 parent 478d8c7 commit 2d11a15

37 files changed

Lines changed: 146 additions & 67 deletions

File tree

  • .chronus/changes
  • packages
    • autorest.python
    • typespec-python
      • test
        • azure/generated
          • azure-example-basic/specs/azure/example/basic/models
          • azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations
          • azure-resource-manager-resources/azure/resourcemanager/resources/models
          • client-namespace/client/clientnamespace/second/sub/models
          • client-naming-enum-conflict/client/naming/enumconflict
          • client-naming/client/naming/main/models
          • client-structure-clientoperationgroup/client/structure/clientoperationgroup/models
          • client-structure-default/client/structure/service/models
          • client-structure-multiclient/client/structure/multiclient/models
          • client-structure-renamedoperation/client/structure/renamedoperation/models
          • client-structure-twooperationgroup/client/structure/twooperationgroup/models
          • encode-array/encode/array/models
          • server-path-multiple/server/path/multiple/models
          • service-multi-service/service/multiservice/models
          • typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models
          • typetest-property-valuetypes/typetest/property/valuetypes/models
          • typetest-union/typetest/union/models
          • versioning-added/versioning/added/models
          • versioning-removed/versioning/removed/models
          • versioning-renamedfrom/versioning/renamedfrom/models
        • unbranded/generated
          • encode-array/encode/array/models
          • server-path-multiple/server/path/multiple/models
          • typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models
          • typetest-property-valuetypes/typetest/property/valuetypes/models
          • typetest-union/typetest/union/models
          • versioning-added/versioning/added/models
          • versioning-removed/versioning/removed/models
          • versioning-renamedfrom/versioning/renamedfrom/models
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
changeKind: fix
3+
packages:
4+
- "@autorest/python"
5+
- "@azure-tools/typespec-python"
6+
---
7+
8+
Properly cache enum values

packages/autorest.python/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
3131
"dependencies": {
32-
"@typespec/http-client-python": "~0.26.1",
32+
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTgxNTE4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.26.1.tgz",
3333
"@autorest/system-requirements": "~1.0.2",
3434
"fs-extra": "~11.2.0",
3535
"tsx": "~4.19.1"
@@ -47,4 +47,4 @@
4747
"requirements.txt",
4848
"generator/"
4949
]
50-
}
50+
}

packages/typespec-python/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@
5858
"@typespec/streams": ">=0.78.0 <1.0.0",
5959
"@typespec/xml": ">=0.78.0 <1.0.0",
6060
"@azure-tools/typespec-azure-core": ">=0.64.0 <1.0.0",
61-
"@azure-tools/typespec-azure-resource-manager": ">=0.64.0 <1.0.0",
62-
"@azure-tools/typespec-autorest": ">=0.64.0 <1.0.0",
61+
"@azure-tools/typespec-azure-resource-manager": ">=0.64.1 <1.0.0",
62+
"@azure-tools/typespec-autorest": ">=0.64.1 <1.0.0",
6363
"@azure-tools/typespec-azure-rulesets": ">=0.64.0 <1.0.0",
6464
"@azure-tools/typespec-client-generator-core": ">=0.64.5 <1.0.0"
6565
},
6666
"dependencies": {
6767
"js-yaml": "~4.1.0",
6868
"semver": "~7.6.2",
6969
"tsx": "~4.19.1",
70-
"@typespec/http-client-python": "~0.26.1",
70+
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTgxNTE4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.26.1.tgz",
7171
"fs-extra": "~11.2.0"
7272
},
7373
"devDependencies": {
@@ -81,11 +81,11 @@
8181
"@typespec/streams": "~0.78.0",
8282
"@typespec/tspd": "~0.70.0",
8383
"@typespec/xml": "~0.78.0",
84-
"@azure-tools/typespec-azure-resource-manager": "~0.64.0",
84+
"@azure-tools/typespec-azure-resource-manager": "~0.64.1",
8585
"@azure-tools/typespec-azure-core": "~0.64.0",
8686
"@azure-tools/typespec-azure-rulesets": "~0.64.0",
87-
"@azure-tools/typespec-autorest": "~0.64.0",
88-
"@azure-tools/typespec-client-generator-core": "~0.64.4",
87+
"@azure-tools/typespec-autorest": "~0.64.1",
88+
"@azure-tools/typespec-client-generator-core": "~0.64.5",
8989
"@azure-tools/azure-http-specs": "0.1.0-alpha.36",
9090
"@typespec/http-specs": "0.1.0-alpha.32-dev.1",
9191
"@typespec/spector": "0.1.0-alpha.22",
@@ -103,4 +103,4 @@
103103
"chalk": "5.3.0",
104104
"@types/fs-extra": "11.0.4"
105105
}
106-
}
106+
}

packages/typespec-python/test/azure/generated/azure-example-basic/specs/azure/example/basic/models/_enums.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ class EnumEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
1414
"""Type of Enum."""
1515

1616
ENUM_VALUE1 = "EnumValue1"
17+
"""ENUM_VALUE1."""

packages/typespec-python/test/azure/generated/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations/_operations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def build_storage_accounts_get_request(
112112
accept = _headers.pop("Accept", "application/json")
113113

114114
# Construct URL
115-
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/storageAccounts/{accountName}"
115+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"
116116
path_format_arguments = {
117117
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
118118
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
@@ -141,7 +141,7 @@ def build_storage_accounts_create_or_update_request( # pylint: disable=name-too
141141
accept = _headers.pop("Accept", "application/json")
142142

143143
# Construct URL
144-
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/storageAccounts/{accountName}"
144+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"
145145
path_format_arguments = {
146146
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
147147
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),

packages/typespec-python/test/azure/generated/azure-resource-manager-resources/azure/resourcemanager/resources/models/_enums.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
3333
CANCELED = "Canceled"
3434
"""Resource creation was canceled."""
3535
PROVISIONING = "Provisioning"
36+
"""PROVISIONING."""
3637
UPDATING = "Updating"
38+
"""UPDATING."""
3739
DELETING = "Deleting"
40+
"""DELETING."""
3841
ACCEPTED = "Accepted"
42+
"""ACCEPTED."""

packages/typespec-python/test/azure/generated/client-namespace/client/clientnamespace/second/sub/models/_enums.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ class SecondClientEnumType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
1414
"""Type of SecondClientEnumType."""
1515

1616
SECOND = "second"
17+
"""SECOND."""

packages/typespec-python/test/azure/generated/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_enums.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta):
1414
"""Status enum in first namespace."""
1515

1616
ACTIVE = "active"
17-
"""Active status"""
17+
"""Active status."""
1818
INACTIVE = "inactive"
19-
"""Inactive status"""
19+
"""Inactive status."""

packages/typespec-python/test/azure/generated/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_enums.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ class SecondStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
1414
"""Status enum in second namespace."""
1515

1616
RUNNING = "running"
17-
"""Running status"""
17+
"""Running status."""
1818
STOPPED = "stopped"
19-
"""Stopped status"""
19+
"""Stopped status."""

packages/typespec-python/test/azure/generated/client-naming/client/naming/main/models/_enums.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ class ClientExtensibleEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
1414
"""Type of ClientExtensibleEnum."""
1515

1616
ENUM_VALUE1 = "value1"
17+
"""ENUM_VALUE1."""
1718

1819

1920
class ExtensibleEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
2021
"""Type of ExtensibleEnum."""
2122

2223
CLIENT_ENUM_VALUE1 = "value1"
24+
"""CLIENT_ENUM_VALUE1."""
2325
CLIENT_ENUM_VALUE2 = "value2"
26+
"""CLIENT_ENUM_VALUE2."""

0 commit comments

Comments
 (0)