Skip to content
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
42 changes: 41 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"name": "Launch TypeScript",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
Expand All @@ -24,6 +24,46 @@
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": "Launch Java",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/kiota/bin/Debug/net5.0/kiota.dll",
"args": ["--openapi",
"C:/sources/github/msgraph-sdk-powershell/openApiDocs/v1.0/mail.yml",
"--language",
"java",
"-o",
"C:/Users/vibiret/Desktop/graphjavav4/utilities/src/main/java/graphjavav4/utilities",
"-n",
"graphjavav4.utilities" ],
"cwd": "${workspaceFolder}/src/kiota",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": "Launch CSharp",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/kiota/bin/Debug/net5.0/kiota.dll",
"args": ["--openapi",
"C:/sources/github/msgraph-sdk-powershell/openApiDocs/v1.0/mail.yml",
"--language",
"csharp",
"-o",
"C:/Users/vibiret/Desktop/graphjavav4/utilities/src/main/java/graphjavav4/utilities",
"-n",
"graphcsharpv4.utilities" ],
"cwd": "${workspaceFolder}/src/kiota",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
Expand Down
9 changes: 9 additions & 0 deletions src/kiota.core/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Linq;

namespace kiota.core {
public static class StringExtensions {
public static string ToLowerFirstCharacter(this string current) {
return $"{char.ToLowerInvariant(current.FirstOrDefault())}{current.Substring(1)}";
}
}
}
2 changes: 1 addition & 1 deletion src/kiota.core/KiotaBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ private CodeMethod CreateOperationMethod(OperationType operationType, OpenApiOpe
}

var method = new CodeMethod() {
Name = operationType.ToString() + "Async",
Name = operationType.ToString(),
ReturnType = new CodeType() { Name = "object"}
};
var methodParameter = new CodeParameter
Expand Down
7 changes: 7 additions & 0 deletions src/kiota.core/Refiners/CSharpRefiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ public override void Refine(CodeNamespace generatedCode)
{
generatedCode.AddUsing(new CodeUsing() { Name = "System" });
generatedCode.AddUsing(new CodeUsing() { Name = "System.Threading.Tasks" });
AddAsyncSuffix(generatedCode);
AddInnerClasses(generatedCode);
}
private void AddAsyncSuffix(CodeElement currentElement) {
if(currentElement is CodeMethod currentMethod)
currentMethod.Name += "Async";
foreach(var childElement in currentElement.GetChildElements())
AddAsyncSuffix(childElement);
}
}
}
2 changes: 1 addition & 1 deletion src/kiota.core/Writers/JavaWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public override void WriteMethod(CodeMethod code)
{
//TODO javadoc
WriteLine("@javax.annotation.Nonnull");
WriteLine($"public java.util.concurrent.Future<{GetTypeString(code.ReturnType)}> {code.Name}({string.Join(',', code.Parameters.Select(p=> GetParameterSignature(p)).ToList())}) {{ return null; }}");
WriteLine($"public java.util.concurrent.Future<{GetTypeString(code.ReturnType)}> {code.Name.ToLowerFirstCharacter()}({string.Join(',', code.Parameters.Select(p=> GetParameterSignature(p)).ToList())}) {{ return null; }}");
}

public override void WriteNamespaceDeclaration(CodeNamespace.BlockDeclaration code)
Expand Down
2 changes: 1 addition & 1 deletion src/kiota.core/Writers/TypeScriptWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public override void WriteIndexer(CodeIndexer code)

public override void WriteMethod(CodeMethod code)
{
WriteLine($"public readonly {code.Name} = ({string.Join(',', code.Parameters.Select(p=> GetParameterSignature(p)).ToList())}) : Promise<{GetTypeString(code.ReturnType)}> => {{ return Promise.resolve({(code.ReturnType.Name.Equals("string") ? "''" : "{}")}); }}");
WriteLine($"public readonly {code.Name.ToLowerFirstCharacter()} = ({string.Join(',', code.Parameters.Select(p=> GetParameterSignature(p)).ToList())}) : Promise<{GetTypeString(code.ReturnType)}> => {{ return Promise.resolve({(code.ReturnType.Name.Equals("string") ? "''" : "{}")}); }}");
}

public override void WriteNamespaceDeclaration(CodeNamespace.BlockDeclaration code) => WriteLine();
Expand Down