Skip to content

Conversation

@samithkavishke
Copy link
Contributor

@samithkavishke samithkavishke commented Nov 14, 2025

Purpose

Fixes : wso2/product-ballerina-integrator#1843

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email [email protected] to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

UI Component Development

Specify the reason if following are not followed.

  • Added reusable UI components to the ui-toolkit. Follow the intructions when adding the componenent.
  • Use ui-toolkit components wherever possible. Run npm run storybook from the root directory to view current components.
  • Matches with the native VSCode look and feel.

Manage Icons

Specify the reason if following are not followed.

  • Added Icons to the font-wso2-vscode. Follow the instructions.

User stories

Issue-1843.mov

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to [email protected] and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

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

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

Summary by CodeRabbit

  • Changes
    • XML import support has been removed from the Type Editor; JSON is now the exclusively supported import format.
    • File input field now accepts only .json files.
    • Placeholder text, UI banners, and messaging updated to reflect JSON-only import functionality.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

Walkthrough

The GenericImportTab component removes XML support, converting it to a JSON-only type editor. XML detection logic, import pathways, and related UI elements are deleted, with all references updated to reflect JSON-only functionality.

Changes

Cohort / File(s) Summary
JSON-only type editor
workspaces/ballerina/type-editor/src/TypeEditor/ContextBasedTypeEditor/GenericImportTab.tsx
Removed XML detection logic from detectFormat; deleted XML import flow (importAsXml); removed XML handling in handleImport; updated UI text, file input acceptance, and placeholders from JSON/XML to JSON only; removed XML-related error messaging and parsing logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Verify XML detection and import branches are fully removed with no orphaned references
  • Confirm UI text updates (banners, placeholders) consistently reflect JSON-only messaging
  • Check file input accept attribute correctly restricts to .json files only

Poem

🐰 XML once danced in this editor's core,
But JSON said "I'll handle the chore!"
With one format now, the code's so neat,
Simpler logic—oh, what a treat! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete with most sections containing only template placeholders. Critical sections like Goals, Approach, Release note, Documentation, and test details are unfilled. Complete all required sections: Goals (solution description), Approach (implementation details), Release note, Documentation impact, and test environment/automation test details.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title '[BI]Remove xml importing functionality' clearly and specifically describes the main change: removal of XML import support from the type editor.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
workspaces/ballerina/type-editor/src/TypeEditor/ContextBasedTypeEditor/GenericImportTab.tsx (2)

163-184: Minor redundancy in error handling.

The detectFormat function sets an error message at line 179 ("Invalid JSON format"), but this gets immediately overwritten by the useEffect at line 158 when UNKNOWN format is detected. Consider removing line 179's setError call since the error will be set by the effect anyway.

Apply this diff to remove the redundant error setting:

            } catch (e) {
                // Not valid JSON, continue checking
-                setError("Invalid JSON format");
            }

313-317: Consider simplifying since only JSON is supported.

Now that XML support is removed, handleImport only needs to handle JSON. The conditional check is somewhat redundant since isImportDisabled() already prevents calls with non-JSON formats.

Apply this diff to simplify:

 const handleImport = async () => {
-    if (detectedFormat === DetectedFormat.JSON) {
-        await importAsJson();
-    }
+    await importAsJson();
 };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20f6525 and b88aac9.

📒 Files selected for processing (1)
  • workspaces/ballerina/type-editor/src/TypeEditor/ContextBasedTypeEditor/GenericImportTab.tsx (4 hunks)
🔇 Additional comments (3)
workspaces/ballerina/type-editor/src/TypeEditor/ContextBasedTypeEditor/GenericImportTab.tsx (3)

97-101: LGTM! DetectedFormat enum correctly simplified to JSON-only.

The removal of XML from the enum is clean and consistent with the PR objectives.


419-420: LGTM! UI text and file restrictions properly updated for JSON-only support.

The info banner, file input accept attribute, and placeholder text are all correctly updated to reflect JSON-only functionality.

Also applies to: 429-429, 492-492


97-101: No external dependencies on removed XML functionality found.

Verification confirms that the XML support removal from GenericImportTab is cleanly isolated:

  • DetectedFormat enum is used only internally within the component; it is not imported or referenced elsewhere
  • GenericImportTab is imported only in ContextTypeEditor.tsx and contains no XML-related expectations
  • XML functionality exists in separate, dedicated components (RecordFromXml, CreateRecord) and is unaffected by these changes
  • No external code depends on the removed XML handling

The change introduces no breaking dependencies.

@sachiniSam
Copy link
Contributor

@samithkavishke , we may need to keep the XML support for FTP Services isn't it?. To support the onFileXml

@samithkavishke
Copy link
Contributor Author

@samithkavishke , we may need to keep the XML support for FTP Services isn't it?. To support the onFileXml

Yes, we need to support that, but currently XML support is not correctly provided by the language server.

@kanushka kanushka changed the base branch from main to bi-1.6.x December 23, 2025 13:17
@kanushka kanushka merged commit 77931a2 into wso2:bi-1.6.x Dec 23, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Temporarily remove XML in resource data binding

3 participants