Skip to content

Add inbound connector input variable suggestion support#1546

Merged
thuva9872 merged 1 commit into
wso2:mainfrom
thuva9872:inbound-main
Jul 24, 2026
Merged

Add inbound connector input variable suggestion support#1546
thuva9872 merged 1 commit into
wso2:mainfrom
thuva9872:inbound-main

Conversation

@thuva9872

Copy link
Copy Markdown
Contributor

Purpose

$subject

Fixes: #1539

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 documentation@wso2.com 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.

User stories

Summary of user stories addressed by this change

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 certification@wso2.com 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.

@thuva9872
thuva9872 requested a review from rosensilva as a code owner July 22, 2026 16:23
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary

  • Added inbound connector input-variable suggestions to the expression helper for inbound endpoint sequences, seeded from the inbound endpoint’s inboundVariableName.
  • Loads, caches, and cleans up per-connector inputschema.json alongside the UI schema so suggestions reflect the connector’s configured input structure.
  • Builds a nested variable/property tree from connector input schema properties, including expansion of #/definitions/... $ref references.
  • Updates tryout handling to parse and edit inbound endpoints correctly before generating mediator tryout info.
  • Gracefully omits suggestions when inboundVariableName is missing/empty, when the connector holder isn’t initialized, or when inputschema.json isn’t available.

Walkthrough

The change adds shared JSON-schema-to-Property conversion, persists inbound connector input schemas alongside UI schemas, and removes cached input schemas during connector cleanup. Tryout handling now resolves inbound endpoint sequences and registers the configured inboundVariableName with its connector input schema when available.

Sequence Diagram(s)

sequenceDiagram
  participant ServerLessTryoutHandler
  participant InboundEndpointVisitor
  participant InboundConnectorHolder
  participant MediatorTryoutInfo
  ServerLessTryoutHandler->>InboundEndpointVisitor: visit inbound endpoint sequence
  InboundEndpointVisitor->>InboundConnectorHolder: load input schema
  InboundConnectorHolder-->>InboundEndpointVisitor: return Property tree
  InboundEndpointVisitor->>MediatorTryoutInfo: register inbound variable
Loading

Suggested reviewers: rosensilva

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description keeps the template but most sections are placeholders and lack the required implementation and testing details. Replace the placeholders with concrete content for goals, approach, user stories, release note, docs, tests, and other required sections.
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: inbound connector input variable suggestion support.
Linked Issues check ✅ Passed The changes align with #1539 by surfacing inbound input variables from inputschema.json and handling missing data gracefully.
Out of Scope Changes check ✅ Passed The code changes stay focused on inbound connector input-variable suggestions and related schema handling.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/inbound/conector/InboundConnectorHolder.java (1)

304-323: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Consider caching the built input-schema Property tree.

getInboundConnectorInputSchema re-reads and re-parses the input schema file from disk on every call, whereas ConnectorAction.getOutputSchema() caches the built Property and returns outputSchema.deepCopy(). Since this is invoked on every inbound-endpoint tryout/variable-suggestion request (a hot path in the expression helper pane), caching per connector id would avoid repeated I/O and JSON parsing. If cached, return a deep copy, since InboundEndpointVisitor.loadInboundVariable mutates the returned Property via setKey(...).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/inbound/conector/InboundConnectorHolder.java`
around lines 304 - 323, Update
InboundConnectorHolder.getInboundConnectorInputSchema to cache the built
Property tree per connector id, avoiding repeated file reads and JSON parsing.
On subsequent calls, return a deep copy of the cached schema rather than the
cached instance, because InboundEndpointVisitor.loadInboundVariable mutates the
returned Property via setKey(...). Preserve the existing null behavior when no
schema is registered or loading fails.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/AbstractConnectorLoader.java`:
- Around line 164-172: Update the connector registration flow around
saveInboundConnector in AbstractConnectorLoader so
saveInboundConnectorInputSchema is executed only when saveInboundConnector
returns true. Preserve the existing file-existence and Constant.ID checks within
that successful-registration guard.

In
`@packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/entity/ConnectorVariableSchemaUtils.java`:
- Around line 109-113: Update the regular-property description handling in
ConnectorVariableSchemaUtils to check that propDescriptionObj is non-null and
not JsonNull before calling getAsString(), falling back to StringUtils.EMPTY for
null values. Apply the same JsonNull guard in the definition-description branch
while preserving existing behavior for valid descriptions.

In
`@packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/mediator/schema/generate/ServerLessTryoutHandler.java`:
- Around line 80-92: Update handle() to catch IllegalArgumentException alongside
IOException and InvalidConfigurationException, so validation failures from
getSTNode() are converted into MediatorTryoutInfo using the exception message
like the existing failure paths.
- Around line 52-72: Update the inbound-endpoint flow in ServerLessTryoutHandler
so the edited temporary sequence file is passed directly to the tryout visitor
instead of being re-resolved from projectUri via Utils.visitSequenceByKey.
Preserve the existing edit-file creation and use the temp path when visiting the
sequence, ensuring inbound-endpoint edits affect execution.

---

Nitpick comments:
In
`@packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/inbound/conector/InboundConnectorHolder.java`:
- Around line 304-323: Update
InboundConnectorHolder.getInboundConnectorInputSchema to cache the built
Property tree per connector id, avoiding repeated file reads and JSON parsing.
On subsequent calls, return a deep copy of the cached schema rather than the
cached instance, because InboundEndpointVisitor.loadInboundVariable mutates the
returned Property via setKey(...). Preserve the existing null behavior when no
schema is registered or loading fails.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f094e75d-4596-41b9-a824-1d877d6fdf34

📥 Commits

Reviewing files that changed from the base of the PR and between 011e3f6 and 1990691.

📒 Files selected for processing (8)
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/AbstractConnectorLoader.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/NewProjectConnectorLoader.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/entity/ConnectorAction.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/entity/ConnectorVariableSchemaUtils.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/inbound/conector/InboundConnectorHolder.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/mediator/schema/generate/ServerLessTryoutHandler.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/mediator/schema/generate/visitor/InboundEndpointVisitor.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/utils/Constant.java

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/NewProjectConnectorLoader.java`:
- Around line 122-134: Update the cleanup logic around the schema name
extraction in NewProjectConnectorLoader so malformed, missing, or null name
fields cannot abort connector loading. Make cache-file deletion best-effort by
handling parsing/runtime failures, and ensure deletion of the extracted
connector directory executes independently of schema cleanup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e177670d-58f1-4392-b07e-e59b522e8689

📥 Commits

Reviewing files that changed from the base of the PR and between 1990691 and a42d0c6.

📒 Files selected for processing (8)
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/AbstractConnectorLoader.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/NewProjectConnectorLoader.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/entity/ConnectorAction.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/entity/ConnectorVariableSchemaUtils.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/inbound/conector/InboundConnectorHolder.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/mediator/schema/generate/ServerLessTryoutHandler.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/mediator/schema/generate/visitor/InboundEndpointVisitor.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/utils/Constant.java
🚧 Files skipped from review as they are similar to previous changes (7)
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/utils/Constant.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/entity/ConnectorVariableSchemaUtils.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/AbstractConnectorLoader.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/mediator/schema/generate/ServerLessTryoutHandler.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/mediator/schema/generate/visitor/InboundEndpointVisitor.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/entity/ConnectorAction.java
  • packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/inbound/conector/InboundConnectorHolder.java

@thuva9872
thuva9872 merged commit 41334d5 into wso2:main Jul 24, 2026
15 of 17 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.

Add input-variable suggestion support for inbound endpoints

2 participants