davsclaus opened a new pull request, #28443:
URL: https://github.com/apache/camel/pull/28443

   ## Description
   
   [CAMEL-26296](https://issues.apache.org/jira/browse/CAMEL-26296)
   
   camel-main binds `camel.language.<name>.<option>` to the setters of the 
Language itself. The catalog only had the options of an *expression* 
(`resultType`, `trim`, ...), and validated these keys against them. Both 
directions were wrong (checked with `camel run`):
   
   - `camel.language.quickjs.engineMaxMemory` works, but `camel validate` 
reported it unknown.
   - `camel.language.simple.trim=false` passed validation, but fails at startup 
(`Error binding property ... with name: trim on bean: SimpleLanguage`).
   
   ### Changes
   
   - **Declaring the options:** the 9 languages with setters declare them with 
`@Metadata` on their fields: bean, java, jsonpath, openfeature, quickjs, 
semantic, typesafe-ai, xpath, xquery. The object-valued ones (`xpathFactory`, 
xquery `configuration`) are advanced options, set with a `#bean` reference.
   - **Catalog JSON:** a new `languageProperties` section, mirroring 
`componentProperties`.
     - It is always written, as `{}` for the 20 languages without options 
(simple, file, groovy, ...). That way "no options" can be told apart from an 
older catalog that does not have the section.
     - The tooling model adds `LanguageModel.getLanguageOptions()` and 
`getConfigurationOptions()`. The latter falls back to the expression options 
for an older catalog.
   - **Validation:** `AbstractCamelCatalog.validateConfigurationProperty` 
validates `camel.language.*` against the language's own options. The source 
editor's property completion and option lookup do the same, and they only offer 
the languages that have options.
   - **camel-jsonpath bug fix:** `camel.language.jsonpath.options` could not be 
set at all. There was no String → `Option[]` converter, so even a single value 
failed at startup.
     - A new `JsonPathConverter` converts a comma-separated list. Names are 
trimmed and matched ignoring case, `-` and `_`.
     - The `option` of an expression uses the same converter.
   - **Plugin:** `UpdateSensitizeHelper` also collects secret and security 
options from `languageProperties`. None exist today, so the generated helpers 
are unchanged.
   - **Docs:**
     - the shared `language-options.adoc` partial adds a "Configuring the 
language" table when a language has options;
     - the simple page no longer says the language "can be configured globally".
   
   Generating a property configurer for languages, so they are bound without 
reflection, is split to 
[CAMEL-26297](https://issues.apache.org/jira/browse/CAMEL-26297).
   
   ### Tests
   
   - `JsonMapperTest`: how a language without options and an older catalog are 
each read and written.
   - `PackageLanguageMojoTest`: options taken from `@Metadata` fields, 
including super classes, enum arrays as `multiEnum`, statics and `skip`, and a 
description required.
   - `CamelCatalogTest`:
     - `quickjs.engineMaxMemory`, `jsonpath.options` and `xpath.resultQName` 
are accepted;
     - `simple.trim`, `tokenize.token` and `quickjs.resultType` are reported 
unknown.
   
     The old test asserted `tokenize.token` and `tokenize.regex` as valid. 
TokenizeLanguage has no setters, so those keys fail at startup.
   - `JsonPathOptionsTest`: the converter, binding `options` onto the language, 
and an expression `option` with spaces around the names.
   - `PropertyCompletionProviderTest`: completion of `camel.language.` and 
`camel.language.quickjs.`.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 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]

Reply via email to