Skip to content

Commit

Permalink
[http-client-python] do not do exception sort if there is no operatio…
Browse files Browse the repository at this point in the history
…n groups (microsoft#5506)

regression from microsoft#5270

fix: Azure/autorest.python#2975
  • Loading branch information
tadelesh authored Jan 7, 2025
1 parent 2e13664 commit 2013626
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
6 changes: 6 additions & 0 deletions packages/http-client-python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log - @typespec/http-client-python

## 0.5.1

### Bug Fixes

- Do not do exception sort if there is no operation groups

## 0.5.0

### Features
Expand Down
2 changes: 1 addition & 1 deletion packages/http-client-python/emitter/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function emitHttpOperation(
apiVersions: [],
wantTracing: true,
exposeStreamKeyword: true,
crossLanguageDefinitionId: method?.crossLanguageDefintionId,
crossLanguageDefinitionId: method?.crossLanguageDefinitionId,
samples: arrayToRecord(method?.operation.examples),
internal: method.access === "internal",
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ def _validate_code_model_options(self) -> None:
@staticmethod
def sort_exceptions(yaml_data: Dict[str, Any]) -> None:
for client in yaml_data["clients"]:
for group in client["operationGroups"]:
for operation in group["operations"]:
for group in client.get("operationGroups", []):
for operation in group.get("operations", []):
if not operation.get("exceptions"):
continue
# sort exceptions by status code, first single status code, then range, then default
Expand All @@ -261,8 +261,8 @@ def sort_exceptions(yaml_data: Dict[str, Any]) -> None:
@staticmethod
def remove_cloud_errors(yaml_data: Dict[str, Any]) -> None:
for client in yaml_data["clients"]:
for group in client["operationGroups"]:
for operation in group["operations"]:
for group in client.get("operationGroups", []):
for operation in group.get("operations", []):
if not operation.get("exceptions"):
continue
i = 0
Expand Down
14 changes: 7 additions & 7 deletions packages/http-client-python/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/http-client-python/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typespec/http-client-python",
"version": "0.5.0",
"version": "0.5.1",
"author": "Microsoft Corporation",
"description": "TypeSpec emitter for Python SDKs",
"homepage": "https://typespec.io",
Expand Down Expand Up @@ -60,7 +60,7 @@
"@azure-tools/typespec-azure-resource-manager": ">=0.49.0 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.49.0 <1.0.0",
"@azure-tools/typespec-azure-rulesets": ">=0.49.0 <3.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.49.0 <1.0.0"
"@azure-tools/typespec-client-generator-core": ">=0.49.1 <1.0.0"
},
"dependencies": {
"js-yaml": "~4.1.0",
Expand All @@ -78,7 +78,7 @@
"@azure-tools/typespec-azure-core": "~0.49.0",
"@azure-tools/typespec-azure-rulesets": "~0.49.0",
"@azure-tools/typespec-azure-resource-manager": "~0.49.0",
"@azure-tools/typespec-client-generator-core": "~0.49.0",
"@azure-tools/typespec-client-generator-core": "~0.49.1",
"@azure-tools/azure-http-specs": "0.1.0-alpha.4",
"@typespec/http-specs": "0.1.0-alpha.5",
"@types/js-yaml": "~4.0.5",
Expand Down

0 comments on commit 2013626

Please sign in to comment.