-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement datamapper #532
Implement datamapper #532
Conversation
…llerina-dev-tools into data-mapped-model
…llerina-dev-tools into data-mapped-model
…llerina-dev-tools into data-mapped-model
…a-dev-tools into data-mapped-model
…a-dev-tools into data-mapped-model
82ff345
to
004da77
Compare
...main/java/io/ballerina/flowmodelgenerator/extension/request/DataMapperAddElementRequest.java
Outdated
Show resolved
Hide resolved
004da77
to
ef1d73c
Compare
|
||
resource function post getPerson(@http:Payload User user) returns Person|http:InternalServerError { | ||
do { | ||
// User1 user1 = {user2: {user3: {i3: user.name.length(), user4: {user5: {u: [user.name, user.name]}}}}, s1: user.name}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this line commented? I've noticed this in other test cases too.
@DataProvider(name = "data-provider") | ||
@Override | ||
protected Object[] getConfigsList() { | ||
return new Object[][]{ | ||
{Path.of("variable1.json")}, | ||
{Path.of("variable2.json")}, | ||
{Path.of("variable3.json")}, | ||
{Path.of("variable4.json")}, | ||
{Path.of("variable5.json")}, | ||
{Path.of("variable6.json")}, | ||
{Path.of("variable7.json")}, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, the method captures all the JSON files in the selected directory. No need to specify each JSON file.
DataMapManager dataMapManager = new DataMapManager(workspaceManager, semanticModel.get(), | ||
document.get()); | ||
response.setSource(dataMapManager.addElement(request.flowNode(), request.propertyKey(), | ||
Path.of(request.filePath()), request.targetField(), project, request.position())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are few occurrences of this
Path.of(request.filePath()), request.targetField(), project, request.position())); | |
filePath, request.targetField(), project, request.position())); |
return null; | ||
} | ||
|
||
Type type = Type.fromSemanticSymbol(targetNode.typeSymbol()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are planning to deprecate this model. Is there a reason why we're sticking to this model instead of using the new types model?
return null; | ||
} | ||
|
||
private record TargetNode(TypeSymbol typeSymbol, String name, ExpressionNode expressionNode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we define this at the top?
for (Map.Entry<String, Object> stringObjectEntry : mappings.entrySet()) { | ||
sb.append(stringObjectEntry.getKey()).append(":"); | ||
sb.append(genSource(stringObjectEntry.getValue())); | ||
|
||
if (i != len - 1) { | ||
sb.append(","); | ||
} | ||
i = i + 1; | ||
} | ||
sb.append("}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (Map.Entry<String, Object> stringObjectEntry : mappings.entrySet()) { | |
sb.append(stringObjectEntry.getKey()).append(":"); | |
sb.append(genSource(stringObjectEntry.getValue())); | |
if (i != len - 1) { | |
sb.append(","); | |
} | |
i = i + 1; | |
} | |
sb.append("}"); | |
StringJoiner joiner = new StringJoiner(","); | |
mappings.forEach((key, value) -> joiner.add(key + ":" + genSource(value))); | |
sb.append(joiner); |
Purpose
$subject