Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
78ef3ca
fix devcontainer
firefart Apr 6, 2025
d5d2588
remove brackets on return types when there is only one
firefart Apr 6, 2025
9f610d5
replace and remove deprecated extensions
firefart Apr 6, 2025
ea19d2b
use tabs instead of spaces
firefart Apr 6, 2025
762b064
update changelog
firefart Apr 6, 2025
6f4eb4f
add recommended c# devkit extension
firefart Apr 7, 2025
b8e41c5
also add github actions extension
firefart Apr 7, 2025
9d2165d
fix more code
firefart Apr 7, 2025
2c3cba1
more work
firefart Apr 7, 2025
2f83574
fix changelog format
firefart Apr 7, 2025
d1fd88b
remove trailing spaces on comments
firefart Apr 7, 2025
98c5003
fix import ordering
firefart Apr 7, 2025
669d86e
remove dependency
firefart Apr 7, 2025
a446f6a
use a constructor
firefart Apr 7, 2025
50f05e9
add comment
firefart Apr 7, 2025
8af4703
simplify sort
firefart Apr 7, 2025
baa18a5
Merge branch 'main' into fmt
baywet Apr 7, 2025
cfad40c
use correct helper method
firefart Apr 7, 2025
1730ef3
Merge branch 'fmt' of github.com:firefart/kiota into fmt
firefart Apr 7, 2025
f5c02e6
simplify another import statement
firefart Apr 7, 2025
050a088
more import ordering fixes
firefart Apr 7, 2025
a021acd
correctly indent switch statements
firefart Apr 7, 2025
19b4464
fix switch statements
firefart Apr 7, 2025
90be6d0
more formatting tweaks
firefart Apr 7, 2025
009d952
more formatting
firefart Apr 7, 2025
710513b
newline after each func
firefart Apr 7, 2025
dc627cb
more formatting
firefart Apr 7, 2025
77a350c
remove more unneeded ;
firefart Apr 8, 2025
0abfc98
cleanup
firefart Apr 8, 2025
340d287
Merge branch 'main' into fmt
firefart Apr 9, 2025
dcca422
Merge branch 'main' into fmt
firefart Apr 9, 2025
ff5d9f5
Merge branch 'main' into fmt
firefart Apr 10, 2025
53f4507
Merge branch 'main' into fmt
firefart Apr 11, 2025
8375072
Merge branch 'main' into fmt
firefart Apr 14, 2025
8252cd9
Merge branch 'main' into fmt
firefart Apr 24, 2025
e57c890
Merge branch 'main' into fmt
firefart May 1, 2025
d5ae502
Merge branch 'microsoft:main' into fmt
firefart May 4, 2025
b95be2b
the java feature is fixed
firefart May 4, 2025
0ad2747
Merge branch 'main' into fmt
firefart May 8, 2025
f0dd33a
Merge branch 'main' into fmt
firefart May 14, 2025
bc7bc6a
Merge branch 'microsoft:main' into fmt
firefart May 16, 2025
2a20e36
remove more spaces at the end
firefart May 16, 2025
a8804af
fix changelog
firefart May 16, 2025
a4eac14
add integration test
firefart May 16, 2025
2c45bf9
simplify
firefart May 16, 2025
bcc7f64
Merge branch 'main' into fmt
firefart May 19, 2025
e91666e
Update src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs
firefart May 19, 2025
91e5980
start fixing unit tests
firefart May 19, 2025
221b1e1
fix unit tests
firefart May 20, 2025
397d712
Merge branch 'main' into fmt
firefart Jun 27, 2025
5471141
Merge branch 'main' into fmt
firefart Jul 11, 2025
76b117c
Merge branch 'main' into fmt
firefart Jul 31, 2025
da9a4b5
Merge branch 'main' into fmt
firefart Oct 24, 2025
de15a35
Merge remote-tracking branch 'origin/main' into fmt
firefart Dec 1, 2025
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
9 changes: 5 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@
"kosunix.guid",
"wix.vscode-import-cost",
"ms-vsliveshare.vsliveshare",
"eg2.vscode-npm-script",
"fknop.vscode-npm",
"ms-vscode.powershell",
"rebornix.ruby",
"Shopify.ruby-lsp",
"visualstudioexptteam.vscodeintellicode",
"streetsidesoftware.code-spell-checker",
"sswg.swift-lang",
"ms-dotnettools.blazorwasm-companion"
"swiftlang.swift-vscode",
"ms-dotnettools.blazorwasm-companion",
"ms-dotnettools.csdevkit",
"github.vscode-github-actions"
]
}
},
Expand Down
13 changes: 9 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added support for OpenAPI 3.2.0
- golang: indent with tabs instead of spaces
- golang: if there is only one return argument, omit the parentheses
- golang: remove trailing spaces on comments
- golang: fix import ordering
- golang: correctly indent case statements inside a switch

### Changed

Expand Down Expand Up @@ -59,7 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed an issue where migration from lock to workspace would fail because of stream management. [#6515](https://github.com/microsoft/kiota/issues/6515)
- Fixed a bug where media types from error responses would be missing from the accept header. [#6572](https://github.com/microsoft/kiota/issues/6572)
- Fixed a bug where serialization names for Dart were not correct [#6624](https://github.com/microsoft/kiota/issues/6624)
- Fixed a bug where imports from __future__ would appear below other imports in python generated code. [#4600](https://github.com/microsoft/kiota/issues/4600)
- Fixed a bug where imports from **future** would appear below other imports in python generated code. [#4600](https://github.com/microsoft/kiota/issues/4600)

## [1.26.1] - 2025-05-15

Expand Down Expand Up @@ -201,7 +206,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed Python error when a class inherits from a base class and implements an interface. [#5637](https://github.com/microsoft/kiota/issues/5637)
- Fixed a bug where one/any schemas with single schema entries would be missing properties. [#5808](https://github.com/microsoft/kiota/issues/5808)
- Fixed anyOf/oneOf generation in TypeScript. [5353](https://github.com/microsoft/kiota/issues/5353)
- Fixed invalid code in Php caused by "*/*/" in property description. [5635](https://github.com/microsoft/kiota/issues/5635)
- Fixed invalid code in Php caused by `"*/*/"` in property description. [5635](https://github.com/microsoft/kiota/issues/5635)
- Fixed a bug where discriminator property name lookup could end up in an infinite loop. [#5771](https://github.com/microsoft/kiota/issues/5771)
- Fixed TypeScript generation error when generating usings from shaken serializers. [#5634](https://github.com/microsoft/kiota/issues/5634)
- Multiple fixed and improvements in OpenAPI description generation for plugins. [#5806](https://github.com/microsoft/kiota/issues/5806)
Expand Down Expand Up @@ -342,7 +347,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added uri-form encoded serialization for PHP. [#2074](https://github.com/microsoft/kiota/issues/2074)
- Added information message with base URL in the CLI experience. [#4635](https://github.com/microsoft/kiota/issues/4635)
- Added optional parameter --disable-ssl-validation for generate, show, and download commands. [#4176](https://github.com/microsoft/kiota/issues/4176)
- For *Debug* builds of kiota, the `--log-level` / `--ll` option is now observed if specified explicitly on the command line. It still defaults to `Debug` for *Debug* builds and `Warning` for *Release* builds. [#4739](https://github.com/microsoft/kiota/pull/4739)
- For _Debug_ builds of kiota, the `--log-level` / `--ll` option is now observed if specified explicitly on the command line. It still defaults to `Debug` for _Debug_ builds and `Warning` for _Release_ builds. [#4739](https://github.com/microsoft/kiota/pull/4739)

### Changed

Expand Down Expand Up @@ -944,7 +949,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed unused generated import for PHP Generation.
- Fixed a bug where long namespaces would make Ruby packaging fail.
- Fixed a bug where classes with namespace names are generated outside namespace in Python. [#2188](https://github.com/microsoft/kiota/issues/2188)
- Changed signature of escaped reserved names from {x}*escaped to {x}* in line with Python style guides.
- Changed signature of escaped reserved names from `{x}*escaped` to `{x}*` in line with Python style guides.
- Add null checks in generated Shell language code.
- Fixed a bug where Go indexers would fail to pass the index parameter.
- Fixed a bug where path segments with parameters could be missing words. [#2209](https://github.com/microsoft/kiota/issues/2209)
Expand Down
8 changes: 8 additions & 0 deletions it/exec-cmd.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ elseif ($language -eq "go") {
go test
} -ErrorAction Stop

Invoke-Call -ScriptBlock {
$fmtStdOut = go fmt ./... 2>&1
if ($fmtStdOut) {
Write-Host "go fmt produced output, so the generated code is not correctly formatted by kiota:`n$fmtStdOut"
exit 1
}
} -ErrorAction Stop

Pop-Location
}
else {
Expand Down
8 changes: 4 additions & 4 deletions it/go/app.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package integrationtest

import (
c "integrationtest/client"
"context"
"fmt"
azidentity "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
a "github.com/microsoft/kiota-authentication-azure-go"
r "github.com/microsoft/kiota-http-go"
"fmt"
"context"
c "integrationtest/client"
)

func main() {
Expand All @@ -33,4 +33,4 @@ func main() {
}
client := c.NewApiClient(adapter)
fmt.Printf("Message: %v\n", client)
}
}
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Refiners/GoRefiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ private static void CorrectMethodType(CodeMethod currentMethod)
currentMethod.Parameters.Where(static x => x.Type.Name.Equals("ISerializationWriter", StringComparison.Ordinal)).ToList().ForEach(x => x.Type.Name = "SerializationWriter");
else if (currentMethod.IsOfKind(CodeMethodKind.Deserializer))
{
currentMethod.ReturnType.Name = $"map[string]func({conventions.SerializationHash}.ParseNode)(error)";
currentMethod.ReturnType.Name = $"map[string]func({conventions.SerializationHash}.ParseNode) error";
currentMethod.Name = "getFieldDeserializers";
}
else if (currentMethod.IsOfKind(CodeMethodKind.ClientConstructor, CodeMethodKind.Constructor, CodeMethodKind.RawUrlConstructor))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected override void WriteTypeDeclaration(ClassDeclaration codeElement, Langu
if (codeElement.Inherits?.AllTypes?.Any() ?? false)
{
var parentTypeName = conventions.GetTypeString(codeElement.Inherits.AllTypes.First(), currentClass, true, false);
writer.WriteLine($"{parentTypeName}");
writer.WriteLine(parentTypeName);
}
}
}
37 changes: 21 additions & 16 deletions src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write
writer.WriteLine($"package {ns.Name.GetLastNamespaceSegment().Replace("-", string.Empty, StringComparison.OrdinalIgnoreCase)}");
}

var usings = codeElement.Usings.OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase).ToArray();
if (usings.Length > 0)
var usings = codeElement.Usings.Select(static x => x.Name).Order(StringComparer.OrdinalIgnoreCase).ToList();
if (usings.Count > 0)
{
writer.StartBlock("import (");
foreach (var cUsing in usings)
writer.WriteLine($"\"{cUsing.Name}\"");
usings.ForEach(x => writer.WriteLine($"\"{x}\""));
writer.CloseBlock(")");
}

Expand All @@ -44,7 +43,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write
foreach (var item in enumOptions)
{
if (item.Documentation.DescriptionAvailable)
writer.WriteLine($"// {item.Documentation.DescriptionTemplate}");
conventions.WriteDescriptionItem(item.Documentation.DescriptionTemplate, writer);

if (isMultiValue)
writer.WriteLine($"{item.Name.ToUpperInvariant()}_{typeName.ToUpperInvariant()} = {(int)Math.Pow(2, power)}");
Expand Down Expand Up @@ -78,7 +77,7 @@ private static void WriteStringFunction(CodeEnum codeElement, LanguageWriter wri
writer.StartBlock($"for p := 0; p < {enumOptions.Count}; p++ {{");
writer.WriteLine($"mantis := {typeName}(int(math.Pow(2, float64(p))))");
writer.StartBlock($"if i&mantis == mantis {{");
writer.WriteLine($"values = append(values, options[p])");
writer.WriteLine("values = append(values, options[p])");
writer.CloseBlock();
writer.CloseBlock();
writer.WriteLine("return strings.Join(values, \",\")");
Expand Down Expand Up @@ -107,31 +106,37 @@ private static void WriteParsableEnum(CodeEnum codeElement, LanguageWriter write
writer.WriteLine($"var result {typeName}");
writer.WriteLine("values := strings.Split(v, \",\")");
writer.StartBlock("for _, str := range values {");
writer.StartBlock("switch str {");
writer.WriteLine("switch str {");
foreach (var item in enumOptions)
{
writer.StartBlock($"case \"{item.WireName}\":");
writer.WriteLine($"case \"{item.WireName}\":");
writer.IncreaseIndent();
writer.WriteLine($"result |= {item.Name.ToUpperInvariant()}_{typeName.ToUpperInvariant()}");
writer.DecreaseIndent();
}
writer.WriteLine("default:");
writer.IncreaseIndent();
writer.WriteLine("return nil, nil");
writer.DecreaseIndent();
writer.WriteLine("}"); // close the switch statement
writer.CloseBlock(); // close the for loop
}
else
{
writer.WriteLine($"result := {enumOptions[0].Name.ToUpperInvariant()}_{typeName.ToUpperInvariant()}");
writer.StartBlock("switch v {");
writer.WriteLine("switch v {");
foreach (var item in enumOptions)
{
writer.StartBlock($"case \"{item.WireName}\":");
writer.WriteLine($"case \"{item.WireName}\":");
writer.IncreaseIndent();
writer.WriteLine($"result = {item.Name.ToUpperInvariant()}_{typeName.ToUpperInvariant()}");
writer.DecreaseIndent();
}
writer.StartBlock("default:");
writer.WriteLine("return nil, nil");
writer.DecreaseIndent();
writer.WriteLine("}");
}

writer.StartBlock("default:");
writer.WriteLine($"return nil, nil");
writer.DecreaseIndent();
writer.CloseBlock();
if (isMultiValue) writer.CloseBlock();
writer.WriteLine("return &result, nil");
writer.CloseBlock();
}
Expand Down
5 changes: 2 additions & 3 deletions src/Kiota.Builder/Writers/Go/CodeFileDeclarationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ public override void WriteCodeElement(CodeFileDeclaration codeElement, LanguageW
.Where(static x => x.Declaration != null && x.Declaration.IsExternal)
.Select(static x => new Tuple<string, string>(x.Name.StartsWith('*') ? x.Name[1..] : x.Declaration!.Name.GetNamespaceImportSymbol(), x.Declaration!.Name))
.Distinct())
.OrderBy(static x => x.Item2.Count(static y => y == '/'))
.ThenBy(static x => x)
.OrderBy(static x => x.Item2) // Item1: import alias, Item2: import path
.ToList();
if (importSegments.Count != 0)
{
writer.WriteLines(string.Empty, "import (");
writer.IncreaseIndent();
importSegments.ForEach(x => writer.WriteLine(x.Item1.Equals(x.Item2, StringComparison.Ordinal) ? $"\"{x.Item2}\"" : $"{x.Item1} \"{x.Item2}\""));
importSegments.ForEach(x => writer.WriteLine(string.IsNullOrEmpty(x.Item1) ? $"\"{x.Item2}\"" : $"{x.Item1} \"{x.Item2}\""));
writer.DecreaseIndent();
writer.WriteLines(")", string.Empty);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected override void WriteTypeDeclaration(InterfaceDeclaration codeElement, L
foreach (var implement in codeElement.Implements)
{
var parentTypeName = conventions.GetTypeString(implement, inter, true, false);
writer.WriteLine($"{parentTypeName}");
writer.WriteLine(parentTypeName);
}
}
}
Loading
Loading