Skip to content

CAMEL-24113: Fix rest-openapi producer cross-contamination for same operation#24803

Merged
davsclaus merged 1 commit into
mainfrom
fix/CAMEL-24113
Jul 16, 2026
Merged

CAMEL-24113: Fix rest-openapi producer cross-contamination for same operation#24803
davsclaus merged 1 commit into
mainfrom
fix/CAMEL-24113

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

Summary

Claude Code on behalf of davsclaus

  • Fix RestOpenApiEndpoint.createProducerFor() to include produces, consumes, queryParameters, and producerComponentName in the delegate rest: endpoint URI, so each unique combination gets its own cached endpoint
  • Previously, only host was included in the URI cache key, causing two rest-openapi endpoints targeting the same operation (same HTTP method + base path + URI template + host) to share one cached RestEndpoint singleton — the last configureProperties() call silently overwrote the first's configuration
  • Add two tests verifying that different produces values and different queryParameters values produce distinct delegate endpoints

Test plan

  • Existing 21 unit tests in RestOpenApiEndpointV3Test pass
  • New test shouldNotCrossContaminateProducersForSameOperation verifies two endpoints with different produces get distinct delegate endpoints
  • New test shouldNotCrossContaminateQueryParameters verifies two endpoints with different literal query parameter values get distinct delegate endpoints
  • Full module test suite (139 tests) passes

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

…rameters, and producerComponentName in delegate rest: endpoint URI to prevent cross-contamination between routes targeting the same operation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@gnodet gnodet 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.

Claude Code on behalf of gnodet

Review — CAMEL-24113: Fix rest-openapi producer cross-contamination for same operation

Well-analyzed bug fix. The endpoint cache key (componentEndpointUri) previously only included host, so two rest-openapi endpoints targeting the same operation with different produces, consumes, queryParameters, or producerComponentName shared one cached RestEndpoint — the last configureProperties() call silently overwrote the first's settings.

The fix

Including all distinguishing options in the delegate URI so each unique combination gets its own cached endpoint. Verified the coverage:

Parameter In URI key? Notes
host Was already there (only one before)
producerComponentName New
consumes New
produces New
queryParameters New, URL-encoded. Includes resolved literal values (via literalQueryParameterValue)

I initially wondered whether queryParameters would just be a template from the spec (same for both endpoints), but traced through queryParameter()literalQueryParameterValue(): when this.parameters contains the param name, it resolves to name=encodedLiteralValue rather than name={name}. So the URI key correctly differentiates literal-value variants. ✅

The UnsafeUriCharactersEncoder.encode() on queryParameters is correct since it may contain = and & characters. ✅

Tests

Both tests use real DefaultCamelContext (started/stopped in try-finally) and verify:

  1. shouldNotCrossContaminateProducersForSameOperation — different produces → 2 distinct delegate endpoints with correct media types ✅
  2. shouldNotCrossContaminateQueryParameters — different literal query param values → 2 distinct delegate endpoints with correct resolved values ✅

Both use AssertJ assertions per project conventions. ✅

LGTM — nice companion fix to #24802.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-rest-openapi

🔬 Scalpel shadow comparison — Scalpel: 18 tested, 29 compile-only — current: 19 all tested

Maveniverse Scalpel detected 47 affected modules (current approach: 19).

⚠️ Modules only in Scalpel (28)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • coverage
  • docs
  • dummy-component

Skip-tests mode would test 18 modules (1 direct + 17 downstream), skip tests for 29 (generated code, meta-modules)

Modules Scalpel would test (18)
  • camel-a2a
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-jsonpath
  • camel-knative-http
  • camel-launcher-container
  • camel-micrometer-prometheus
  • camel-oauth
  • camel-observability-services
  • camel-openapi-validator
  • camel-platform-http-main
  • camel-platform-http-vertx
  • camel-rest-openapi
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin
Modules with tests skipped (29)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (47 modules)
  • Camel :: AI :: A2A
  • Camel :: All Components Sync point
  • Camel :: Assembly
  • Camel :: Catalog :: CSimple Maven Plugin (deprecated)
  • Camel :: Catalog :: Camel Catalog
  • Camel :: Catalog :: Camel Report Maven Plugin
  • Camel :: Catalog :: Camel Route Parser
  • Camel :: Catalog :: Console
  • Camel :: Catalog :: Dummy Component
  • Camel :: Catalog :: Lucene (deprecated)
  • Camel :: Catalog :: Maven
  • Camel :: Catalog :: Suggest
  • Camel :: Component DSL
  • Camel :: Coverage
  • Camel :: Docs
  • Camel :: Endpoint DSL
  • Camel :: Endpoint DSL :: Support
  • Camel :: Integration Tests
  • Camel :: JBang :: Core
  • Camel :: JBang :: Integration tests
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Main
  • Camel :: JBang :: Plugin :: Edit
  • Camel :: JBang :: Plugin :: Generate
  • Camel :: JBang :: Plugin :: Kubernetes
  • Camel :: JBang :: Plugin :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Testing
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: JSon Path
  • Camel :: Kamelet Main
  • Camel :: Knative HTTP
  • Camel :: Launcher
  • Camel :: Launcher :: Container
  • Camel :: Micrometer :: Prometheus
  • Camel :: OAuth
  • Camel :: Observability Services
  • Camel :: OpenAPI :: Validator
  • Camel :: Platform HTTP :: Main
  • Camel :: Platform HTTP :: Vert.x
  • Camel :: REST OpenApi
  • Camel :: YAML DSL
  • Camel :: YAML DSL :: Deserializers
  • Camel :: YAML DSL :: Maven Plugins
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@davsclaus davsclaus added this to the 4.22.0 milestone Jul 16, 2026
@davsclaus davsclaus self-assigned this Jul 16, 2026
@davsclaus davsclaus added the bug Something isn't working label Jul 16, 2026
@davsclaus
davsclaus merged commit d5c92b0 into main Jul 16, 2026
5 checks passed
@davsclaus
davsclaus deleted the fix/CAMEL-24113 branch July 16, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants