Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/hardcoded error module names #2004

Merged
merged 3 commits into from
Nov 29, 2022
Merged
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
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