Skip to content

camel-docling: mark the apiKeyHeader option as deprecated (it is never used) - #29591

Merged
davsclaus merged 1 commit into
apache:mainfrom
WMK666666:fix-docling-apikey-header
Nov 12, 2026
Merged

davsclaus merged 1 commit into
apache:mainfrom
WMK666666:fix-docling-apikey-header

Conversation

@WMK666666

Copy link
Copy Markdown
Contributor

The docling-serve client (docling-serve-client 0.7.0) always sends the API key in a hardcoded X-Api-Key header -- the header name is not configurable by the caller. DoclingProducer only hands the key value to the builder:

doclingServeClientBuilder.apiKey(configuration.getAuthenticationToken());

apiKeyHeader is never read anywhere in the component: its getter has no caller, and the setter only stores the value. So the option has never had any effect -- and a user who follows the docs and sets apiKeyHeader=X-Custom-API-Key against a docling-serve instance that expects a custom header gets a silent authentication failure, with nothing in the logs to explain it.

This keeps the option (removing it would break existing endpoint URIs) but marks it deprecated with a note that says why, which is the same treatment camel-neo4j already gives its ineffective query option.

Changes

  • DoclingConfiguration: @Deprecated + deprecationNote on the apiKeyHeader field, getter and setter, so the deprecation reaches tooling and the generated docs.
  • docling.json: regenerated (deprecated / deprecationNote for apiKeyHeader).
  • docling-serve.adoc: dropped the "Using Custom API Key Header" section -- it documented a configuration that cannot work -- and removed apiKeyHeader from the API_KEY examples. Replaced with a note that the key always goes in X-Api-Key.

No behaviour change: the option was already inert.

Verification

./mvnw -pl components/camel-ai/camel-docling install -> BUILD SUCCESS (formatter, checkstyle, enforcer and rat all pass). Reverting only the annotation and rebuilding makes docling.json report "deprecated": false again, so the metadata really is driven by the source annotation rather than edited by hand.

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

Correct deprecation — apiKeyHeader is genuinely never read by DoclingProducer and the approach mirrors the camel-neo4j deprecation pattern. LGTM.

One minor observation:

This review was generated by an AI agent, Hermès on behalf of @gnodet.

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

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

Thanks, the analysis holds: apiKeyHeader is never read (DoclingProducer only calls builder.apiKey(...), and docling-serve-client 0.7.0 hardcodes the header name to X-Api-Key). Deprecating it with a note, as with the camel-neo4j query option, is the right call.

Before merge:

  1. Generated files are missing. The PR changes only the component's docling.json, the adoc and DoclingConfiguration. These copies also change and are not in the PR:

    • catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/docling.json (still "deprecated": false for apiKeyHeader)
    • catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/docling-serve.adoc (any edit to src/main/docs needs the catalog copy)
    • DoclingEndpointBuilderFactory (camel-endpointdsl) and DoclingComponentBuilderFactory (camel-componentdsl): the apiKeyHeader(...) builders gain @Deprecated and the note, as Neo4jEndpointBuilderFactory.query(...) has.

    Please build camel-docling plus the catalog and DSL modules and commit everything that changes; CI fails on uncommitted generated files.

  2. Upgrade guide. A deprecated option needs an entry in docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc, as the neo4j one has. Two lines are enough: apiKeyHeader never had any effect, and the key is always sent as X-Api-Key.

  3. Nit (same as the open bot thread): DoclingConfiguration.java:131-134 uses X-API-Key for the default and X-Api-Key in the note. Header names are case-insensitive, so it is cosmetic; X-Api-Key is what the client sends.

Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ Generated files are up to date

An earlier CI run reported uncommitted generated changes; the latest run no longer does.

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

Following up on my earlier review — the generated files have been added (catalog JSON, catalog adoc, componentdsl, endpointdsl), which addresses davsclaus's main concern. Two items remain open.

Upgrade guide — still missing. A new entry is required in docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc, matching the pattern used for the camel-neo4j query deprecation. Two lines are sufficient: apiKeyHeader never had any effect, and the key is always sent as X-Api-Key.

Casing inconsistency — still open (nit). The deprecationNote text and the Javadoc @deprecated tag both use X-Api-Key, while the defaultValue attribute and the field initializer still use X-API-Key. HTTP header names are case-insensitive, so there is no functional difference, but consistency is cleaner — pick one spelling.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

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

Thanks, the Regen commit (29f1d7b) adds the generated files from point 1: the catalog docling.json and docling-serve.adoc, and the two DSL builders. The catalog doc matches the source doc. I approved the CI runs for this head.

Still needed before merge:

  • Upgrade guide: a short entry in docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc (under a camel-docling heading). It should say that apiKeyHeader is deprecated and never had any effect, because the docling-serve client always sends the key in X-Api-Key.
  • The nit in the open thread, X-API-Key vs X-Api-Key in DoclingConfiguration, is optional.

Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • components/camel-ai/camel-docling
  • docs
  • dsl/camel-componentdsl
  • dsl/camel-endpointdsl

🔬 Scalpel shadow comparison — Scalpel: 10 of 722 tested, 23 compile-only — current: 10 all tested

Maveniverse Scalpel detected 10 affected modules (current approach: 10).

Skip-tests mode would test 10 modules (5 direct + 9 downstream), skip tests for 23 (generated code, meta-modules)

Modules Scalpel would test (10)
  • camel-docling ← components/camel-ai/camel-docling/src/generated/resources/META-INF/org/apache/camel/component/docling/docling.json, components/camel-ai/camel-docling/src/main/docs/docling-serve.adoc, components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/DoclingConfiguration.java
  • camel-jbang-mcp ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-mcp ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-tui ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-validate ← downstream of org.apache.camel:camel-yaml-dsl-validator
  • camel-jbang-run ← downstream of org.apache.camel:camel-catalog
  • camel-langchain4j-ingest ← downstream of org.apache.camel:camel-docling
  • camel-launcher-container ← downstream of org.apache.camel:camel-launcher
  • camel-yaml-dsl-validator ← downstream of org.apache.camel:camel-catalog
  • camel-yaml-dsl-validator-maven-plugin ← downstream of org.apache.camel:camel-yaml-dsl-validator
Modules with tests skipped (23)
  • apache-camel
  • camel-allcomponents
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • 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
  • dummy-component

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

All tested modules (37 modules, 5m 9s total)

Total reactor time: 5m 9s

Module Duration Status
Camel :: JBang :: MCP 44.0s SUCCESS
Camel :: AI :: LangChain4j :: Ingest 26.3s SUCCESS
Camel :: YAML DSL :: Validator 23.2s SUCCESS
Camel :: JBang :: Plugin :: Validate 23.2s SUCCESS
Camel :: Catalog :: Camel Catalog 19.7s SUCCESS
Camel :: YAML DSL 19.7s SUCCESS
Camel :: AI :: Docling 18.8s SUCCESS
Camel :: Component DSL 16.5s SUCCESS
Camel :: JBang :: Run 16.3s SUCCESS
Camel :: Kamelet Main 15.3s SUCCESS
Camel :: Docs 12.8s SUCCESS
Camel :: JBang :: Plugin :: Kubernetes 12.4s SUCCESS
Camel :: JBang :: Plugin :: Testing 10.7s SUCCESS
Camel :: YAML DSL :: Deserializers 6.2s SUCCESS
Camel :: Catalog :: Camel Report Maven Plugin 6.1s SUCCESS
Camel :: Catalog :: Camel Route Parser 6.0s SUCCESS
Camel :: JBang :: Plugin :: Generate 4.4s SUCCESS
Camel :: Assembly 4.1s SUCCESS
Camel :: All Components Sync point 4.0s SUCCESS
Camel :: YAML DSL :: Validator Maven Plugin 3.9s SUCCESS
Camel :: Catalog :: Maven 2.5s SUCCESS
Camel :: YAML DSL :: Maven Plugins 2.3s SUCCESS
Camel :: Catalog :: Suggest (deprecated) 1.7s SUCCESS
Camel :: JBang :: Plugin :: MCP 1.4s SUCCESS
Camel :: JBang :: Integration tests 1.2s SUCCESS
Camel :: Coverage 1.2s SUCCESS
Camel :: Endpoint DSL :: Support 0.9s SUCCESS
Camel :: JBang :: Main 0.8s SUCCESS
Camel :: Catalog :: Dummy Component 0.8s SUCCESS
Camel :: JBang :: Plugin :: Edit 0.8s SUCCESS
Camel :: Launcher :: Container 0.8s SUCCESS
Camel :: Catalog :: Console 0.7s SUCCESS
Camel :: Endpoint DSL n/a
Camel :: Integration Tests n/a
Camel :: JBang :: Core n/a
Camel :: JBang :: Plugin :: TUI n/a
Camel :: Launcher n/a

Top 20 slowest modules:

  • Camel :: JBang :: MCP (44.0s)
  • Camel :: AI :: LangChain4j :: Ingest (26.3s)
  • Camel :: YAML DSL :: Validator (23.2s)
  • Camel :: JBang :: Plugin :: Validate (23.2s)
  • Camel :: Catalog :: Camel Catalog (19.7s)
  • Camel :: YAML DSL (19.7s)
  • Camel :: AI :: Docling (18.8s)
  • Camel :: Component DSL (16.5s)
  • Camel :: JBang :: Run (16.3s)
  • Camel :: Kamelet Main (15.3s)
  • Camel :: Docs (12.8s)
  • Camel :: JBang :: Plugin :: Kubernetes (12.4s)
  • Camel :: JBang :: Plugin :: Testing (10.7s)
  • Camel :: YAML DSL :: Deserializers (6.2s)
  • Camel :: Catalog :: Camel Report Maven Plugin (6.1s)
  • Camel :: Catalog :: Camel Route Parser (6.0s)
  • Camel :: JBang :: Plugin :: Generate (4.4s)
  • Camel :: Assembly (4.1s)
  • Camel :: All Components Sync point (4.0s)
  • Camel :: YAML DSL :: Validator Maven Plugin (3.9s)

⚙️ View full build and test results

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

Correct to deprecate rather than keep advertising an option that does nothing: since the docling-serve client always sends the API key in X-Api-Key, apiKeyHeader never changed anything, and a security-group option that silently has no effect is worse than no option. The deprecation note says exactly why, and removing it from the examples and tests stops people copying a no-op. One small thing, not blocking: deprecating an option is the kind of change the 4.24 upgrade guide usually gets a one-line note for, even when the option never worked, so anyone who set it knows it is going away. LGTM.

Claude Code on behalf of oscerd

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

Following up on my earlier review — both open items have been addressed in the latest commit.

Upgrade guide — ✅ added under camel-docling in camel-4x-upgrade-guide-4_24.adoc. Correctly states that apiKeyHeader never had any effect and that X-Api-Key is the fixed header name.

Casing consistency — ✅ defaultValue and field initializer now use X-Api-Key consistently throughout (Java source, JSON metadata, DSL builders). The whole PR is coherent on the spelling.

No further issues. LGTM.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@WMK666666

Copy link
Copy Markdown
Contributor Author

Both remaining items are in 7f61c1b.

Upgrade guide. An entry under a camel-docling heading in docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc. It says the option never had any effect, that the client fixes the header name to X-Api-Key, and what to do about it (drop apiKeyHeader; with authenticationScheme=API_KEY and authenticationToken the key is still sent).

Casing. Picked X-Api-Key, because that is what the client actually sends: defaultValue and the field initializer now match the deprecationNote and the Javadoc. The regenerated metadata and DSL builders follow — the four generated copies carry "defaultValue": "X-Api-Key" with "deprecated": true for both the property and the parameter, and DoclingComponentBuilderFactory/DoclingEndpointBuilderFactory say Default: X-Api-Key.

The component, its tests and the two formatter checks are green locally.

@WMK666666
WMK666666 force-pushed the fix-docling-apikey-header branch from 7f61c1b to befeeaa Compare November 11, 2026 13:43
@WMK666666

Copy link
Copy Markdown
Contributor Author

Heads up: the branch is now one commit on top of current main (befeeaa), so the older commits including the regen one are gone from the history. The diff is the same plus the two items above.

Reason: main has regenerated metadata since this PR's base, and the generator no longer writes an empty deprecationNote on every entry. The regen commit here had been produced with the older generator, so this branch rewrote all ~120 entries of docling.json and the PR conflicted with main. Rebuilding on main and taking only the two apiKeyHeader entries from the regenerated file keeps the diff to the option: the two docling.json copies now differ from main in exactly those two lines, and the docs, the source file and the two DSL builders are unchanged apart from this PR's change.

git diff main --stat locally: 8 files, +51 / -106.

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

Re-review of befeeaa (the branch was rebuilt as one commit on current main, so I compared it with main and with the reviewed 29f1d7b).

Both open points from my last review are done:

  • Upgrade guide: camel-4x-upgrade-guide-4_24.adoc now has a camel-docling - the apiKeyHeader option is deprecated entry. It says the option never had any effect, that the key always goes in X-Api-Key, and what to do about it.
  • Casing: DoclingConfiguration.java:130-134 uses X-Api-Key for the defaultValue, the field, the deprecationNote and the Javadoc. The generated copies match.

Rebuilding on main was the right move. The generated files now differ from main only in the two apiKeyHeader entries of both docling.json copies (identical blobs) and the three @Deprecated DSL builders. The catalog docling-serve.adoc matches the source doc. The format is the same as the neo4j query deprecation, and the removed "Using Custom API Key Header" section had no xrefs pointing at it.

Small things, none blocking:

  1. The PR description's "Changes" list still names only DoclingConfiguration, docling.json and the adoc. It could also mention the upgrade-guide entry, the catalog/DSL regen and the X-API-Key -> X-Api-Key default.
  2. #29594 and #29595 also append a camel-docling entry to the end of the 4.24 upgrade guide. Whichever PR merges second has a trivial text conflict there and needs a rebase.

LGTM once the queued CI run on befeeaa is green.

Claude Code on behalf of Claus Ibsen. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@Croway

Croway commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

These tests failed
| Failed Test | Duration | Failure Type | | --- | --- | --- | | org.apache.camel.dsl.jbang.core.commands.ExportMainApplicationPropertiesTest.shouldExportUserPropertyOverride(RuntimeType)[1] | 0.268s | FAILURE | | org.apache.camel.dsl.jbang.core.commands.ExportMainApplicationPropertiesTest.shouldExportUserPropertyOverride(RuntimeType)[2] | 0.510s | FAILURE | | org.apache.camel.dsl.jbang.core.commands.ExportMainApplicationPropertiesTest.shouldExportUserPropertyOverride(RuntimeType)[3] | 0.266s | FAILURE |

… effect

The docling-serve client sends the API key in the X-Api-Key header, the name is
fixed in the client, and the producer never read the option: a user who set
apiKeyHeader got no warning and no effect, while the option sat in the security
group of the endpoint.

Deprecate it with a note, as the camel-neo4j query option is deprecated, and drop
it from the examples of the docling-serve page and from the tests, so nobody
copies a no-op. The catalog metadata and the two DSL builder factories follow,
and the 4.24 upgrade guide gets the entry a deprecation takes.

The default value and the field initializer said X-API-Key while the deprecation
note said X-Api-Key; both now say X-Api-Key, the spelling the client sends.
@davsclaus
davsclaus force-pushed the fix-docling-apikey-header branch from befeeaa to 7a2d06e Compare November 11, 2026 20:06
@davsclaus davsclaus added this to the 4.24.0 milestone Nov 12, 2026
@davsclaus davsclaus added the task label Nov 12, 2026
@davsclaus
davsclaus merged commit 5de82a9 into apache:main Nov 12, 2026
7 checks passed
WMK666666 added a commit to WMK666666/camel that referenced this pull request Nov 12, 2026
…e request

Rebased on main now that apache#29591 and apache#29593 are in.

The only conflict was the end of the camel-docling section of the 4.24
upgrade guide, where apache#29591 appended its apiKeyHeader entry: both entries
are kept, the apiKeyHeader one first.

DoclingProducer.java also gained the bearer-token client from apache#29593; it
merged cleanly with the OCR header resolution, which sits in
resolveOcrSettings and applyConfigurationToOptions.

Content is otherwise the one approved in 80d7804: the two headers are
resolved once per message into OcrSettings on the thread that owns the
exchange, so no batch worker touches the exchange, and a language header
does not turn OCR back on when the endpoint disabled it.
WMK666666 added a commit to WMK666666/camel that referenced this pull request Nov 12, 2026
…ocling-serve

Rebased on main now that apache#29591 and apache#29593 are in.

The only conflict was the end of the camel-docling section of the 4.24
upgrade guide, where apache#29591 appended its apiKeyHeader entry: both entries
are kept, the apiKeyHeader one first.

DoclingProducer.java also gained the bearer-token client from apache#29593; it
merged cleanly with the html_split_page rejection in mapToOutputFormat.

Content is otherwise the one reviewed in 1617c89: DoclingContentExtractor
reads doctags_content when DocTags is requested, and mapToOutputFormat
rejects html_split_page with the reason and the way out, because
DocumentResponse has no field for the split pages.
davsclaus pushed a commit that referenced this pull request Nov 12, 2026
camel-docling: honour the OCR headers in the CLI command and the serve request

Rebased on main now that #29591 and #29593 are in.

The only conflict was the end of the camel-docling section of the 4.24
upgrade guide, where #29591 appended its apiKeyHeader entry: both entries
are kept, the apiKeyHeader one first.

DoclingProducer.java also gained the bearer-token client from #29593; it
merged cleanly with the OCR header resolution, which sits in
resolveOcrSettings and applyConfigurationToOptions.

Content is otherwise the one approved in 80d7804: the two headers are
resolved once per message into OcrSettings on the thread that owns the
exchange, so no batch worker touches the exchange, and a language header
does not turn OCR back on when the endpoint disabled it.
WMK666666 added a commit to WMK666666/camel that referenced this pull request Nov 12, 2026
…ocling-serve

Rebased on main now that apache#29595 is in, as asked.

The only conflict was the 4.24 upgrade guide, where apache#29595 appended its
OCR-headers entry after apache#29591's apiKeyHeader one: the file now carries
all three camel-docling sections, apiKeyHeader first, then the OCR
headers, then html_split_page.

DoclingProducer.java merged cleanly with the OcrSettings refactor from
apache#29595: the html_split_page rejection and the package-private
mapToOutputFormat sit below resolveOcrSettings and are untouched by it.
DoclingContentExtractor.java is unchanged on main.

Content is otherwise the version approved in 55f1def: DoclingContentExtractor
reads doctags_content when DocTags is requested, and mapToOutputFormat
rejects html_split_page with the reason and the way out, because
DocumentResponse has no field for the split pages.
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.

5 participants