Skip to content

Commit

Permalink
Merge pull request #1070 from microsoft/bugfix/go-array-serialization
Browse files Browse the repository at this point in the history
go array serialization update
  • Loading branch information
baywet committed Jan 25, 2022
2 parents 87c13b4 + 1d217bc commit 84ac0af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fixed an issue where multiple api clients could run into racing conditions in Go.
- Fixed a bug where empty additional data in Go would lead to invalid JSON payloads during serialization.
- Fixed a bug where Go serialization would write empty arrays for nil values.

## [0.0.15] - 2021-12-17

Expand Down
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs
Expand Up @@ -485,7 +485,7 @@ CodeMethodKind.Setter when (code.AccessedProperty?.IsNameEscaped ?? false) && !s
var errorPrefix = $"err {errorVarDeclaration(shouldDeclareErrorVar)}= writer.";
var isEnum = propType is CodeType eType && eType.TypeDefinition is CodeEnum;
var isClass = propType is CodeType cType && cType.TypeDefinition is CodeClass;
if(isEnum && !propType.IsCollection)
if(isEnum || propType.IsCollection)
writer.WriteLine($"if {valueGet} != nil {{");
else
writer.WriteLine("{");// so the err var scope is limited
Expand Down

0 comments on commit 84ac0af

Please sign in to comment.