Skip to content

CAMEL-24340: camel-salesforce: improve option and header documentation - #25323

Merged
davsclaus merged 1 commit into
apache:mainfrom
stn1slv:CAMEL-24340-salesforce-option-descriptions
Aug 4, 2026
Merged

CAMEL-24340: camel-salesforce: improve option and header documentation#25323
davsclaus merged 1 commit into
apache:mainfrom
stn1slv:CAMEL-24340-salesforce-option-descriptions

Conversation

@stn1slv

@stn1slv stn1slv commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

JIRA: https://issues.apache.org/jira/browse/CAMEL-24340

The defect

apexMethod is documented as "APEX method name", but the component uses the value verbatim as the HTTP verb of the Apex REST call:

  • AbstractRestProcessor:637 reads the option, defaulting it to GET at :640
  • :653 passes it as the first argument to restClient.apexCall(...)
  • RestClient:243 declares that parameter as String httpMethod ("HTTP method to execute")
  • DefaultRestClient:499 forwards it to getRequest(httpMethod, ...), and AbstractClientBase:169-171 passes it into Jetty's HttpRequest.method(String)

There is no validation or lookup at any step. A user who follows the documentation and sets apexMethod to their real Apex method name, for example getMerchandise, makes Camel issue GETMERCHANDISE /services/apexrest/..., which fails.

The wording dates from CAMEL-8772 (2015) and has been propagated mechanically since.

Why this is not cosmetic: the hand-written Apex table already says "The HTTP method (e.g. GET, POST) to use", but the generated options table is included in the same page (salesforce-component.adoc:58-60, about 175 lines above), so the page contradicts itself. More importantly the javadoc is what surfaces in IDE completion, the endpoint DSL builders, Camel JBang and Karavan tooling, and Spring Boot metadata, where the prose page is not visible at all.

Other descriptions improved in the same pass

These restated the option name without saying what the value controls:

Option Added
apexUrl It is a path relative to /services/apexrest/, not a URL, and can be given as the option, in the endpoint path as apexCall/MyApexClass/, or via CamelSalesforceApexUrl
jobId Which operations need it, and that it covers Bulk API v1 and 2.0
batchId Bulk API v1 only; BulkApiV2Processor never reads it
resultId Used only by getQueryResult, sourced from getQueryResultIds
pubSubHost / pubSubPort gRPC transport and the operations that use them

Plus 15 Streaming API and Change Data Capture headers that followed a bare "The <name>." template. Most map to fields of the Salesforce ChangeEventHeader.

Worth noting: CamelSalesforceEventType carries two different values. For change and platform events it is the last segment of the configured topic name (StreamingApiConsumer:181,225); for PushTopic messages it is the Salesforce event type (:254). The description now covers both.

Scope and testing

Documentation only. Every changed line is javadoc or @Metadata text, so there is no behaviour change and no test is applicable. Descriptions were derived by reading the call sites rather than from the option names, and claims that could not be verified in code (Salesforce id formats, an exhaustive list of Apex verbs) were deliberately left out.

The regenerated metadata is included for the component, the catalog, and the generated Endpoint DSL and Component DSL builders, as is the convention for metadata changes.


Generated by Claude Code on behalf of @stn1slv

The apexMethod option was documented as "APEX method name", but the value
is used verbatim as the HTTP verb of the Apex REST call.
AbstractRestProcessor reads it, defaults it to GET, and passes it to
RestClient.apexCall, whose parameter is named httpMethod and which feeds
it straight into the HTTP request. A user following the documentation and
supplying their actual Apex method name produces a malformed HTTP verb.

The component doc page already described it correctly as the HTTP method,
so the generated options table and the prose table contradicted each
other on the same rendered page. The javadoc text is also what surfaces
in IDE completion, the endpoint DSL builders, Camel JBang tooling and
Spring Boot metadata, where the prose page is not visible at all.

Improve the surrounding descriptions in the same pass, since they
restated the option name without saying what the value controls:

- apexUrl: a path relative to /services/apexrest/, not a URL. It can be
  supplied as the option, in the endpoint path, or via a header.
- jobId: name the operations that need it, and that it covers Bulk API
  v1 and 2.0.
- batchId: Bulk API v1 only; BulkApiV2Processor never reads it.
- resultId: used only by getQueryResult, sourced from getQueryResultIds.
- pubSubHost and pubSubPort: name the gRPC transport and the operations.
- 15 Streaming API and Change Data Capture headers that followed a bare
  "The <name>." template. Most map to fields of the Salesforce
  ChangeEventHeader. Note that CamelSalesforceEventType carries two
  different values depending on the message kind.

Documentation only. No behaviour change: this edits javadoc and
@metadata descriptions and regenerates the component metadata.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@stn1slv
stn1slv force-pushed the CAMEL-24340-salesforce-option-descriptions branch from 2e87ff7 to 86ae4a4 Compare August 4, 2026 09:46
@stn1slv
stn1slv marked this pull request as ready for review August 4, 2026 09:56

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

Good documentation improvement — the apexMethod fix alone prevents a real user pitfall (the old "APEX method name" description was misleading; the value is actually the HTTP verb, as confirmed by AbstractRestProcessor.java:637-640). The header descriptions for Streaming API / CDC are much more useful than the prior "The <name>." template.

Two minor observations (non-blocking):

  1. defaultValue = "GET" on @UriParam for apexMethod: factually correct (matches the runtime default at AbstractRestProcessor:640), but note this is a metadata change — generated catalogs and tooling will now show a default value that was previously absent. Since it documents real behavior, this is fine.

  2. CamelSalesforceCreatedDate: the new description honestly notes the dual-type behavior (ZonedDateTime for platform events, String for PushTopic). The declared javaType = "java.time.ZonedDateTime" is a pre-existing inaccuracy that is correctly left out of scope here.

Generated files (catalog JSON, component DSL, endpoint DSL) are consistent with the source changes.

Note: this review covers project conventions and rules compliance. It does not replace specialized AI review tools (CodeRabbit, Sourcery) or static analyzers (SonarCloud).

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

@github-actions

github-actions Bot commented Aug 4, 2026

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.

@davsclaus davsclaus added this to the 4.22.0 milestone Aug 4, 2026
@davsclaus
davsclaus merged commit 42d07a8 into apache:main Aug 4, 2026
5 checks passed
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • components/camel-salesforce/camel-salesforce-component
  • dsl/camel-componentdsl
  • dsl/camel-endpointdsl

🔬 Scalpel shadow comparison — Scalpel: 14 tested, 26 compile-only — current: 11 all tested

Maveniverse Scalpel detected 40 affected modules (current approach: 11).

⚠️ Modules only in Scalpel (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

Skip-tests mode would test 14 modules (4 direct + 10 downstream), skip tests for 26 (generated code, meta-modules)

Modules Scalpel would test (14)
  • camel-catalog
  • camel-componentdsl
  • camel-endpointdsl
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-launcher-container
  • camel-salesforce
  • camel-salesforce-codegen
  • camel-salesforce-maven-plugin
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin
Modules with tests skipped (26)
  • apache-camel
  • camel-allcomponents
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-csimple-maven-plugin
  • 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 (40 modules)
  • 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 :: Kamelet Main
  • Camel :: Launcher
  • Camel :: Launcher :: Container
  • Camel :: Salesforce
  • Camel :: Salesforce :: CodeGen
  • Camel :: Salesforce :: Maven Plugin
  • 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants