Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
rkodev committed Oct 28, 2024
1 parent 162658c commit 8baada8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Refiners/TypeScriptRefiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ private static void AddDeserializerUsingToDiscriminatorFactoryForComposedTypePar

function.AddUsing(new CodeUsing
{
Name = modelDeserializerFunction.Parent.Name,
Name = modelDeserializerFunction.Name,
Declaration = new CodeType
{
Name = modelDeserializerFunction.Name,
Expand Down
5 changes: 4 additions & 1 deletion src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,10 @@ private string FindFunctionInNameSpace(string functionName, CodeElement codeElem
var codeFunction = Array.Find(codeFunctions,
func => func.GetImmediateParentOfType<CodeNamespace>().Name == myNamespace.Name) ??
throw new InvalidOperationException($"Function {functionName} not found in namespace {myNamespace.Name}");
return conventions.GetTypeString(new CodeType { TypeDefinition = codeFunction }, codeElement, false);

var targetElement = codeElement.GetImmediateParentOfType<CodeFile>();

return GetTypescriptTypeString(new CodeType { TypeDefinition = codeFunction }, targetElement, includeCollectionInformation: false);
}

private void WriteSerializerFunction(CodeFunction codeElement, LanguageWriter writer)
Expand Down
6 changes: 4 additions & 2 deletions src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public override void WriteCodeElement(CodeMethod codeElement, LanguageWriter wri
ArgumentNullException.ThrowIfNull(writer);
if (codeElement.Parent is CodeFunction) return;

var returnType = GetTypescriptTypeString(codeElement.ReturnType, codeElement, inlineComposedTypeString: true);
var codeFile = codeElement.GetImmediateParentOfType<CodeFile>();
var returnType = GetTypescriptTypeString(codeElement.ReturnType, codeFile, inlineComposedTypeString: true);
var isVoid = "void".EqualsIgnoreCase(returnType);
WriteMethodDocumentation(codeElement, writer, isVoid);
WriteMethodPrototype(codeElement, writer, returnType, isVoid);
Expand All @@ -30,6 +31,7 @@ private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer, bo
}
internal static void WriteMethodDocumentationInternal(CodeMethod code, LanguageWriter writer, bool isVoid, TypeScriptConventionService typeScriptConventionService)
{
var codeFile = code.GetImmediateParentOfType<CodeFile>();
var returnRemark = (isVoid, code.IsAsync) switch
{
(true, _) => string.Empty,
Expand All @@ -41,7 +43,7 @@ internal static void WriteMethodDocumentationInternal(CodeMethod code, LanguageW
code.Parameters
.Where(static x => x.Documentation.DescriptionAvailable)
.OrderBy(static x => x.Name)
.Select(x => $"@param {x.Name} {x.Documentation.GetDescription(type => GetTypescriptTypeString(type, code, inlineComposedTypeString: true), ReferenceTypePrefix, ReferenceTypeSuffix, RemoveInvalidDescriptionCharacters)}")
.Select(x => $"@param {x.Name} {x.Documentation.GetDescription(type => GetTypescriptTypeString(type, codeFile, inlineComposedTypeString: true), ReferenceTypePrefix, ReferenceTypeSuffix, RemoveInvalidDescriptionCharacters)}")
.Union([returnRemark])
.Union(GetThrownExceptionsRemarks(code)));
}
Expand Down

0 comments on commit 8baada8

Please sign in to comment.