Skip to content
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

Merged
merged 7 commits into from
Sep 20, 2024

Conversation

mindula
Copy link
Contributor

@mindula mindula commented Jun 26, 2024

Purpose

$title.

Fixes #42653

Approach

Describe how you are implementing the solutions along with the design details.

Samples

Provide high-level details about the samples related to this feature.

Remarks

List any other known issues, related PRs, TODO items, or any other notes related to the PR.

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

Copy link

codecov bot commented Jun 26, 2024

Codecov Report

Attention: Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.

Project coverage is 77.36%. Comparing base (207d34e) to head (6f9754c).
Report is 169 commits behind head on master.

Files with missing lines Patch % Lines
...ina/xmltorecordconverter/XMLToRecordConverter.java 90.90% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

@mindula mindula added the Team/LanguageServer Language Server Implementation related issues. #Compiler label Jul 2, 2024
@@ -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,
Copy link
Contributor

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 ?

Copy link
Contributor

@prakanth97 prakanth97 Jul 3, 2024

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

Copy link
Contributor Author

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.

Comment on lines 586 to 592
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);
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added the Stale label Jul 19, 2024
@mindula mindula removed the Stale label Jul 21, 2024
Copy link

github-actions bot commented Aug 5, 2024

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added the Stale label Aug 5, 2024
@nipunayf nipunayf removed the Stale label Aug 6, 2024
Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added Stale and removed Stale labels Sep 10, 2024
@gimantha gimantha merged commit 4dbc2fb into ballerina-platform:master Sep 20, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team/LanguageServer Language Server Implementation related issues. #Compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement]: Support a new option to add attributes in XML to Record conversion
5 participants