Add inbound connector input variable suggestion support#1546
Conversation
📝 WalkthroughSummary
WalkthroughThe change adds shared JSON-schema-to- 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
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 winConsider caching the built input-schema
Propertytree.
getInboundConnectorInputSchemare-reads and re-parses the input schema file from disk on every call, whereasConnectorAction.getOutputSchema()caches the builtPropertyand returnsoutputSchema.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, sinceInboundEndpointVisitor.loadInboundVariablemutates the returnedPropertyviasetKey(...).🤖 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
📒 Files selected for processing (8)
packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/AbstractConnectorLoader.javapackages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/NewProjectConnectorLoader.javapackages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/entity/ConnectorAction.javapackages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/entity/ConnectorVariableSchemaUtils.javapackages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/inbound/conector/InboundConnectorHolder.javapackages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/mediator/schema/generate/ServerLessTryoutHandler.javapackages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/mediator/schema/generate/visitor/InboundEndpointVisitor.javapackages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/utils/Constant.java
There was a problem hiding this comment.
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
📒 Files selected for processing (8)
packages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/AbstractConnectorLoader.javapackages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/NewProjectConnectorLoader.javapackages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/entity/ConnectorAction.javapackages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/connectors/entity/ConnectorVariableSchemaUtils.javapackages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/inbound/conector/InboundConnectorHolder.javapackages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/mediator/schema/generate/ServerLessTryoutHandler.javapackages/mi-language-server/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/mediator/schema/generate/visitor/InboundEndpointVisitor.javapackages/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
Purpose
$subject
Fixes: #1539
Goals
Approach
User stories
Release note
Documentation
Training
Certification
Marketing
Automation tests
Security checks
Samples
Related PRs
Migrations (if applicable)
Test environment
Learning