-
Notifications
You must be signed in to change notification settings - Fork 737
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
Add new option to remove attributes and attribute annotation in XML to record conversion #42989
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #42989 +/- ##
============================================
+ Coverage 77.30% 77.36% +0.05%
- Complexity 58541 58601 +60
============================================
Files 3460 3460
Lines 220070 220096 +26
Branches 28909 28912 +3
============================================
+ Hits 170136 170286 +150
+ Misses 40524 40391 -133
- Partials 9410 9419 +9 ☔ View full report in Codecov by Sentry. |
@@ -97,7 +97,8 @@ private XMLToRecordConverter() {} | |||
|
|||
public static XMLToRecordResponse convert(String xmlValue, boolean isRecordTypeDesc, boolean isClosed, | |||
boolean forceFormatRecordFields, | |||
String textFieldName, boolean withNameSpaces) { | |||
String textFieldName, boolean withNameSpaces, boolean withoutAttributes, |
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 choose the name withoutAttributes
instead of withAttributes
?
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.
I feel like, we are loosing consistency with withNameSpaces
parameter 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.
I added withoutAttributes
because the default behaviour includes attributes, and the checkbox we will show in the UI will be labeled Without Attributes
or Remove Attributes
. I thought changing the option to withAttributes
might confuse the tooling team.
String xmlFileContent = Files.readString(sample36XML); | ||
String generatedCodeBlock = XMLToRecordConverter.convert(xmlFileContent, false, false, false, | ||
"__text", false, false, true).getCodeBlock().replaceAll("\\s+", ""); | ||
String expectedCodeBlock = Files.readString(sample37Bal).replaceAll("\\s+", ""); | ||
Assert.assertEquals(generatedCodeBlock, expectedCodeBlock); |
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.
Shall we rename the xml source and the generated bal with same name? here source is sample_36.xml
and the generated bal file is sample_37.bal
, which is confusing.
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.
Here, I used the same xml file for two test cases.
...ord-converter/src/test/java/io/ballerina/xmltorecordconverter/XMLToRecordConverterTests.java
Show resolved
Hide resolved
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
Purpose
$title.
Fixes #42653
Approach
Samples
Remarks
Check List