Skip to content

Commit

Permalink
Merge pull request #1624 from lnash94/master
Browse files Browse the repository at this point in the history
[master] Fix for openAPI client generation test failures
  • Loading branch information
lnash94 authored Mar 21, 2024
2 parents 0096822 + b7b57d1 commit 7a1b4a7
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@
import static io.ballerina.compiler.syntax.tree.SyntaxKind.FINAL_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.FUNCTION_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.ISOLATED_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.OBJECT_METHOD_DEFINITION;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.OPEN_BRACE_TOKEN;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.OPEN_PAREN_TOKEN;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.PUBLIC_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.QUESTION_MARK_TOKEN;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.REMOTE_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.RESOURCE_ACCESSOR_DEFINITION;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.RESOURCE_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.RETURNS_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.RETURN_KEYWORD;
Expand Down Expand Up @@ -323,8 +325,9 @@ private FunctionDefinitionNode createInitFunction() throws BallerinaOpenApiExcep
FunctionBodyNode functionBodyNode = getInitFunctionBodyNode();
NodeList<Token> qualifierList = createNodeList(createToken(PUBLIC_KEYWORD), createToken(ISOLATED_KEYWORD));
IdentifierToken functionName = createIdentifierToken("init");
return createFunctionDefinitionNode(null, getInitDocComment(), qualifierList, createToken(FUNCTION_KEYWORD),
functionName, createEmptyNodeList(), functionSignatureNode, functionBodyNode);
return createFunctionDefinitionNode(OBJECT_METHOD_DEFINITION, getInitDocComment(), qualifierList,
createToken(FUNCTION_KEYWORD), functionName, createEmptyNodeList(), functionSignatureNode,
functionBodyNode);
}

/**
Expand Down Expand Up @@ -588,7 +591,8 @@ private FunctionDefinitionNode getClientMethodFunctionDefinitionNode(List<Annota
createNodeList(GeneratorUtils.getRelativeResourcePath(path, operation.getValue(),
null, openAPI.getComponents(), false)) :
createEmptyNodeList();
return createFunctionDefinitionNode(null,
SyntaxKind kind = resourceMode ? RESOURCE_ACCESSOR_DEFINITION : OBJECT_METHOD_DEFINITION;
return createFunctionDefinitionNode(kind,
metadataNode, qualifierList, functionKeyWord, functionName, relativeResourcePath,
functionSignatureNode, functionBodyNode);
}
Expand Down

0 comments on commit 7a1b4a7

Please sign in to comment.