Skip to content

Commit

Permalink
Merge pull request #2004 from microsoft/bugfix/hardcoded-error-module…
Browse files Browse the repository at this point in the history
…-names

Bugfix/hardcoded error module names
  • Loading branch information
samwelkanda authored Nov 29, 2022
2 parents b527b66 + 293c3dd commit f4ed1b1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed a bug where request information would always be set from scalar. [#1965](https://github.com/microsoft/kiota/pull/1965)
- Fixed a bug where path parameters would be missing if no operation was present at the segment the parameter is defined. [#1940](https://github.com/microsoft/kiota/issues/1940)
- Fixed a bug where generation would result in wrong indentation in some classes for Python [#1996]((https://github.com/microsoft/kiota/issues/1996).
- Fixed a bug where error class modules were hardcoded for Python [#1999]((https://github.com/microsoft/kiota/issues/1999)
- Fixed a bug where generation would sometimes result in wrong original names for query parameters in Python [#2000]((https://github.com/microsoft/kiota/issues/2000).


## [0.7.1] - 2022-11-01

### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ private void WriteRequestExecutorBody(CodeMethod codeElement, RequestParams requ
writer.WriteLine($"{errorMappingVarName}: Dict[str, ParsableFactory] = {{");
writer.IncreaseIndent();
foreach(var errorMapping in codeElement.ErrorMappings) {
writer.WriteLine($"\"{errorMapping.Key.ToUpperInvariant()}\": o_data_error.{errorMapping.Value.Name},");
writer.WriteLine($"\"{errorMapping.Key.ToUpperInvariant()}\": {errorMapping.Value.Name.ToSnakeCase()}.{errorMapping.Value.Name},");
}
writer.CloseBlock();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ public void WritesRequestExecutorBody() {
var result = tw.ToString();
Assert.Contains("request_info", result);
Assert.Contains("error_mapping: Dict[str, ParsableFactory] =", result);
Assert.Contains("\"4XX\": o_data_error.Error4XX", result);
Assert.Contains("\"5XX\": o_data_error.Error5XX", result);
Assert.Contains("\"403\": o_data_error.Error403", result);
Assert.Contains("\"4XX\": error4_x_x.Error4XX", result);
Assert.Contains("\"5XX\": error5_x_x.Error5XX", result);
Assert.Contains("\"403\": error403.Error403", result);
Assert.Contains("send_async", result);
Assert.Contains("raise Exception", result);
}
Expand Down

0 comments on commit f4ed1b1

Please sign in to comment.