allthingssecurity opened a new pull request, #30997: URL: https://github.com/apache/camel/pull/30997
# Description [CAMEL-27608](https://issues.apache.org/jira/browse/CAMEL-27608) The ticket lists two problems of camel-langchain4j-web-search that came up while the option descriptions were written for CAMEL-23832 (#30940). I checked both against main and fixed both. Fixed: 1. **The search options could not be set on the component.** `LangChain4jWebSearchComponent` had a `configuration` field with `@Metadata` but no setter, so no component options were generated from `LangChain4jWebSearchConfiguration`, and the component configurer only knew `lazyStartProducer` and `autowiredEnabled`. `camel.component.langchain4j-web-search.maxResults` and the other options failed to bind. The component now has `setConfiguration()`, as the other camel-langchain4j components have, so the search options are component options too. `createEndpoint()` already copied the component configuration into each endpoint, and options set on the endpoint override it. 2. **maxResults and resultType were required although they have a default.** Both fields hold their default (1 and CONTENT), so a user never has to set them. They are no longer marked required. `webSearchEngine` is now also an autowired component option. With exactly one `WebSearchEngine` in the registry the component gets it and passes it to its endpoints, which is the same engine the endpoint autowiring found before. No upgrade guide entry: nothing that worked before behaves differently. This touches the same files as #30940 (the configuration class and the generated files), so whichever is merged second needs a small rebase. No description text in #30940 becomes wrong with this change; the new component options take the descriptions that #30940 writes for the endpoint options. Tests (new, unit tests with a `WebSearchEngine` lambda, no network): - `LangChain4jWebSearchComponentOptionsTest`: binds `webSearchEngine`, `maxResults`, `resultType` and `language` on the component the way property configuration does (through the component configurer), with two engines in the registry so that nothing can be autowired. An endpoint without options searches with the component engine and options; an endpoint with its own options overrides them and keeps the component `language`. Against the main sources both tests fail: the component options cannot be bound (`PropertyBindingException` for `language`). Results (offline, module build of camel-langchain4j-web-search, test phase): 13 tests run, 0 failures, 0 errors, 0 skipped. The new test class passes 5 runs in a row. Generated files: `langchain4j-web-search.json` of the component and its catalog copy, `LangChain4jWebSearchComponentConfigurer`, the component DSL (`Langchain4jWebSearchComponentBuilderFactory`, the new component options) and the endpoint DSL (`LangChain4jWebSearchEndpointBuilderFactory`, the `Required: true` lines of the two options). # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it): [CAMEL-27608](https://issues.apache.org/jira/browse/CAMEL-27608). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. (I built camel-langchain4j-web-search and ran its unit tests, and committed the regenerated component JSON and configurer. The catalog copy and the component and endpoint DSL were updated to match it, as an offline build of those modules was not possible here. I did not run the full root build.) # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. This PR was prepared with Claude Code (Claude Opus 5.5). The commit carries a `Co-Authored-By` trailer. _Claude Code on behalf of allthingssecurity_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
