-
Notifications
You must be signed in to change notification settings - Fork 36
Improve LS APIs to support tuple type mappings #653
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
Draft
pasindufernando1
wants to merge
13
commits into
ballerina-platform:data-mapper-extended-types
Choose a base branch
from
pasindufernando1:TupleBEChanges
base: data-mapper-extended-types
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1d3fdf2
Refactor tuple member related info
pasindufernando1 7fd16c3
Handle tuple inputs in mappings
pasindufernando1 006f2e1
Improve APIs to support inline tuples mappings
pasindufernando1 cf9ddb7
Support tuple mappings and visualization in reusable mode
pasindufernando1 1aec4a0
Support tuple member mapping deletion in reusable data mapper
pasindufernando1 d605bd5
Remove module info data from tuple members
pasindufernando1 416f2f4
Resolve checkstyle violation
pasindufernando1 e1a76a9
Address PR suggestions
pasindufernando1 08dac6c
Fix tuple mapping inconsistencies in queries
pasindufernando1 6b5ef46
Fix failing test case
pasindufernando1 501c05c
Remove element access index from tuple mappings
pasindufernando1 85acd4a
Add newline at EOF
pasindufernando1 a8c8470
Address PR suggestions
pasindufernando1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
337 changes: 297 additions & 40 deletions
337
...del-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/DataMapManager.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 125 additions & 0 deletions
125
.../flow-model-generator-ls-extension/src/test/resources/data_mapper_model/config/tuple.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| { | ||
| "source": "variable50.bal", | ||
| "description": "Sample diagram node", | ||
| "codedata": { | ||
| "node": "VARIABLE", | ||
| "lineRange": { | ||
| "fileName": "variable50.bal", | ||
| "startLine": { | ||
| "line": 17, | ||
| "offset": 8 | ||
| }, | ||
| "endLine": { | ||
| "line": 17, | ||
| "offset": 39 | ||
| } | ||
| }, | ||
| "sourceCode": "Bar[] bars = [\n {a: 1, b: 3},\n (from var baz in bazs\n select {a: baz.x, b: baz.y})[0]\n ];" | ||
| }, | ||
| "position": { | ||
| "line": 17, | ||
| "offset": 8 | ||
| }, | ||
| "targetField": "person", | ||
| "model": { | ||
| "inputs": [ | ||
| { | ||
| "members": [ | ||
| { | ||
| "name": "[0]", | ||
| "displayName": "data[0]", | ||
| "typeName": "int", | ||
| "kind": "int" | ||
| }, | ||
| { | ||
| "name": "[1]", | ||
| "displayName": "data[1]", | ||
| "typeName": "string", | ||
| "kind": "string" | ||
| }, | ||
| { | ||
| "name": "[2]", | ||
| "displayName": "data[2]", | ||
| "typeName": "float", | ||
| "kind": "float" | ||
| } | ||
| ], | ||
| "name": "data", | ||
| "displayName": "data", | ||
| "typeName": "[int, string, float]", | ||
| "kind": "tuple", | ||
| "category": "local-variable" | ||
| } | ||
| ], | ||
| "output": { | ||
| "fields": [], | ||
| "name": "person", | ||
| "displayName": "person", | ||
| "typeName": "Person", | ||
| "kind": "record", | ||
| "ref": "887620673" | ||
| }, | ||
| "mappings": [ | ||
| { | ||
| "output": "person.age", | ||
| "inputs": [ | ||
| "data[0]" | ||
| ], | ||
| "expression": "data[0]", | ||
| "diagnostics": [], | ||
| "elements": [], | ||
| "isQueryExpression": false, | ||
| "isFunctionCall": false | ||
| } | ||
| ], | ||
| "refs": { | ||
| "887620673": { | ||
| "fields": [ | ||
| { | ||
| "name": "name", | ||
| "displayName": "name", | ||
| "typeName": "string", | ||
| "kind": "string", | ||
| "optional": false | ||
| }, | ||
| { | ||
| "name": "age", | ||
| "displayName": "age", | ||
| "typeName": "int", | ||
| "kind": "int", | ||
| "optional": false | ||
| }, | ||
| { | ||
| "members": [ | ||
| { | ||
| "name": "[0]", | ||
| "displayName": "data[0]", | ||
| "typeName": "int", | ||
| "kind": "int" | ||
| }, | ||
| { | ||
| "name": "[1]", | ||
| "displayName": "data[1]", | ||
| "typeName": "string", | ||
| "kind": "string" | ||
| }, | ||
| { | ||
| "name": "[2]", | ||
| "displayName": "data[2]", | ||
| "typeName": "float", | ||
| "kind": "float" | ||
| } | ||
| ], | ||
| "name": "data", | ||
| "displayName": "data", | ||
| "typeName": "[int, string, float]", | ||
| "kind": "tuple", | ||
| "optional": false | ||
| } | ||
| ], | ||
| "typeName": "Person", | ||
| "kind": "record" | ||
| } | ||
| } | ||
| } | ||
| } |
185 changes: 185 additions & 0 deletions
185
...or-ls-extension/src/test/resources/data_mapper_model/config/tupleBasedTransformation.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,185 @@ | ||
| { | ||
| "source": "tupleBasedTransformation.bal", | ||
| "description": "Sample diagram node", | ||
| "codedata": { | ||
| "node": "VARIABLE", | ||
| "lineRange": { | ||
| "fileName": "tupleBasedTransformation.bal", | ||
| "startLine": { | ||
| "line": 28, | ||
| "offset": 0 | ||
| }, | ||
| "endLine": { | ||
| "line": 28, | ||
| "offset": 123 | ||
| } | ||
| }, | ||
| "sourceCode": "Bar[] bars = [\n {a: 1, b: 3},\n (from var baz in bazs\n select {a: baz.x, b: baz.y})[0]\n ];" | ||
| }, | ||
| "position": { | ||
| "line": 28, | ||
| "offset": 91 | ||
| }, | ||
| "targetField": "transform1", | ||
| "model": { | ||
| "inputs": [ | ||
| { | ||
| "fields": [], | ||
| "name": "course", | ||
| "displayName": "course", | ||
| "typeName": "Course", | ||
| "kind": "record", | ||
| "category": "parameter", | ||
| "ref": "524765447" | ||
| }, | ||
| { | ||
| "fields": [], | ||
| "name": "person", | ||
| "displayName": "person", | ||
| "typeName": "DetailedPerson", | ||
| "kind": "record", | ||
| "category": "parameter", | ||
| "ref": "-692431599" | ||
| } | ||
| ], | ||
| "output": { | ||
| "members": [ | ||
| { | ||
| "name": "[0]", | ||
| "displayName": "transform1[0]", | ||
| "typeName": "int", | ||
| "kind": "int" | ||
| }, | ||
| { | ||
| "name": "[1]", | ||
| "displayName": "transform1[1]", | ||
| "typeName": "string", | ||
| "kind": "string" | ||
| }, | ||
| { | ||
| "fields": [], | ||
| "name": "[2]", | ||
| "displayName": "transform1[2]", | ||
| "typeName": "Course", | ||
| "kind": "record", | ||
| "ref": "524765447" | ||
| } | ||
| ], | ||
| "name": "transform1", | ||
| "displayName": "transform1", | ||
| "typeName": "[int, string, Course]", | ||
| "kind": "tuple" | ||
| }, | ||
| "mappings": [ | ||
| { | ||
| "output": "transform1", | ||
| "inputs": [], | ||
| "expression": "[0, person.id, {id: person.id}]", | ||
| "diagnostics": [ | ||
| { | ||
| "message": "missing non-defaultable required record field 'credits'", | ||
| "code": "BCE2520" | ||
| }, | ||
| { | ||
| "message": "missing non-defaultable required record field 'name'", | ||
| "code": "BCE2520" | ||
| } | ||
| ], | ||
| "elements": [ | ||
| { | ||
| "mappings": [ | ||
| { | ||
| "output": "transform1[0]", | ||
| "inputs": [], | ||
| "expression": "0", | ||
| "diagnostics": [], | ||
| "elements": [], | ||
| "isQueryExpression": false, | ||
| "isFunctionCall": false | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "mappings": [ | ||
| { | ||
| "output": "transform1[1]", | ||
| "inputs": [ | ||
| "person.id" | ||
| ], | ||
| "expression": "person.id", | ||
| "diagnostics": [], | ||
| "elements": [], | ||
| "isQueryExpression": false, | ||
| "isFunctionCall": false | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "mappings": [ | ||
| { | ||
| "output": "transform1[2].id", | ||
| "inputs": [ | ||
| "person.id" | ||
| ], | ||
| "expression": "person.id", | ||
| "diagnostics": [], | ||
| "elements": [], | ||
| "isQueryExpression": false, | ||
| "isFunctionCall": false | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "refs": { | ||
| "-692431599": { | ||
| "fields": [ | ||
| { | ||
| "name": "id", | ||
| "displayName": "id", | ||
| "typeName": "string", | ||
| "kind": "string", | ||
| "optional": false | ||
| }, | ||
| { | ||
| "name": "name", | ||
| "displayName": "name", | ||
| "typeName": "string", | ||
| "kind": "string", | ||
| "optional": false | ||
| } | ||
| ], | ||
| "typeName": "DetailedPerson", | ||
| "kind": "record" | ||
| }, | ||
| "524765447": { | ||
| "fields": [ | ||
| { | ||
| "name": "id", | ||
| "displayName": "id", | ||
| "typeName": "string", | ||
| "kind": "string", | ||
| "optional": false | ||
| }, | ||
| { | ||
| "name": "name", | ||
| "displayName": "name", | ||
| "typeName": "string", | ||
| "kind": "string", | ||
| "optional": false | ||
| }, | ||
| { | ||
| "name": "credits", | ||
| "displayName": "credits", | ||
| "typeName": "float", | ||
| "kind": "float", | ||
| "optional": false | ||
| } | ||
| ], | ||
| "typeName": "Course", | ||
| "kind": "record" | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.