Skip to content

feat(odata): support v1 element template variable format#132

Open
vringar wants to merge 2 commits into
release/8.7from
feat/odata-v1-fallback
Open

feat(odata): support v1 element template variable format#132
vringar wants to merge 2 commits into
release/8.7from
feat/odata-v1-fallback

Conversation

@vringar
Copy link
Copy Markdown
Contributor

@vringar vringar commented Feb 25, 2026

Summary

Adds backward compatibility so the OData connector can process variables sent by v1 (pre-batch) element templates in addition to the current v2 format. Both the v2 task type (with fallback detection) and the legacy v1 task type are supported.

Problem

The v1 element template sends variables in a flat structure (destination, oDataService, entityOrEntitySet, httpMethod.*, payload) without the requestDetails.requestType discriminator that the v2 connector expects. When context.bindVariables(ODataConnectorRequest.class) receives v1 input, it silently sets requestDetails = null, causing runtime failures downstream.

Additionally, some customer deployments use the legacy task type io.camunda:sap:odata:outbound: (with trailing colon) which no v2 worker listens for.

Approach

Two complementary mechanisms ensure v1 templates work regardless of which task type they use:

  1. Fallback in ODataConnector (type io.camunda:sap-odata:2): After binding, if requestDetails is null, the connector re-binds using FallbackODataConnectorRequest and converts to a standard request. This catches v1 templates that happen to target the v2 task type.

  2. LegacyODataConnector (type io.camunda:sap:odata:outbound:): A separate connector class registered via SPI that directly binds flat v1 variables through FallbackODataConnectorRequest and delegates to ODataRequestExecutor.

Changes

File Change
FallbackODataConnectorRequest.java New — fallback model with validation (@NotEmpty, @Pattern, @Valid) and conversion to ODataConnectorRequest
LegacyODataConnector.java New — connector worker for legacy task type io.camunda:sap:odata:outbound:
ODataConnector.java Modified — fallback detection when requestDetails is null after binding
OutboundConnectorFunction (SPI) Modified — added LegacyODataConnector to service loader
pom.xml Modified — added Lombok annotation processor path (required for Java 22+ on release/8.7)
s4-v1-get.bpmn New — example BPMN with v1 flat variable structure for testing
BaseTest.java New — JSON test case loader
OutboundBaseTest.java New — connector context builder helper
HotfixBindingTest.java New — 3 parameterized tests for binding and conversion
hotfix.json New — test fixture with v1 variable structure

Testing

Unit tests

3 parameterized tests in HotfixBindingTest:

  1. Proves ODataConnectorRequest binding produces requestDetails = null for v1 input (documents the problem)
  2. Proves FallbackODataConnectorRequest binding succeeds with typed HttpMethod instances
  3. Proves toODataConnectorRequest() correctly converts fallback → canonical request

E2E validation on BTP (SaaS 8.7 cluster)

  • v2 task type with v1 variables: Deployed s4-v1-get.bpmn (task type io.camunda:sap-odata:2, flat variables). Logs confirmed fallback triggered and OData request constructed correctly.
  • Legacy task type: Deployed BPMN with task type io.camunda:sap:odata:outbound:. LegacyODataConnector picked up the job, bound flat variables, and executed the OData request successfully.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds backward compatibility to the SAP OData connector so it can handle the legacy v1 (pre-batch) element template variable shape where requestDetails.requestType is missing, by rebinding via a fallback model and converting to the current request format.

Changes:

  • Introduces FallbackODataConnectorRequest to bind the v1 flat variable structure and convert it to ODataConnectorRequest (wrapping a SimpleRequest).
  • Updates ODataConnector.execute() to detect requestDetails == null and re-bind using the fallback model (with an INFO log when used).
  • Adds test infrastructure + fixture (hotfix.json) and new binding tests covering the legacy input shape.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
odata-connector/src/main/java/io/camunda/connector/sap/odata/model/FallbackODataConnectorRequest.java New fallback request record with validation annotations and conversion to the v2 request structure.
odata-connector/src/main/java/io/camunda/connector/sap/odata/ODataConnector.java Adds runtime fallback re-binding when v1 inputs cause requestDetails to deserialize as null.
odata-connector/src/test/java/io/camunda/connector/sap/odata/BaseTest.java New shared test helper for loading JSON test cases as strings.
odata-connector/src/test/java/io/camunda/connector/sap/odata/OutboundBaseTest.java New helper for creating an OutboundConnectorContextBuilder with secrets.
odata-connector/src/test/java/io/camunda/connector/sap/odata/HotfixBindingTest.java New parameterized tests documenting the binding issue and validating fallback binding + conversion.
odata-connector/src/test/resources/hotfix.json New legacy-input fixture used by the binding tests.

@vringar vringar force-pushed the feat/odata-v1-fallback branch 2 times, most recently from 93f0c69 to 826fbfd Compare February 25, 2026 14:41
@vringar vringar changed the base branch from main to release/8.7 February 25, 2026 14:43
@vringar vringar force-pushed the feat/odata-v1-fallback branch 2 times, most recently from b0c5b53 to 5481cf4 Compare February 25, 2026 15:36
@vringar vringar force-pushed the feat/odata-v1-fallback branch from 5481cf4 to 55041ba Compare March 4, 2026 16:28
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 13, 2026

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

3 participants