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

   CAMEL-25739: some options take several of their enum values, separated by 
comma, but their metadata was a plain enum.
   
   - The catalog validator compared the whole value with each enum value, so it 
rejected a valid list such as `ehcache:orders?eventTypes=CREATED,UPDATED`.
   - The YAML DSL schema rejected `option: 
ALWAYS_RETURN_LIST,SUPPRESS_EXCEPTIONS` of the jsonpath language.
   - Tools could offer only one value to pick.
   
   ## What
   
   - **`multiEnum` on `@UriParam` and `@Metadata`.** The JSON metadata of such 
an option has `"multiEnum": true`. It is written only when set, so no other 
JSON file changes.
   - **Catalog validator:** it checks each value of the list, with the spaces 
around the commas left out, and reports the value that is wrong, so the "did 
you mean" suggestion fits it. An option without the flag still takes one value: 
`consul:kv?action=PUT,GET_VALUE` is still rejected.
   - **YAML DSL schema:** a JSON schema enum cannot describe a list, so the 
option is a string with a pattern of the comma-separated values. When a value 
is wrong, the validator hint names the values instead of showing the pattern. 
The completion tree keeps the values and marks the option with `multiEnum`.
   - **`camel_catalog_doc`** says that several values can be set.
   - **The options:** ehcache `eventTypes`, jcache `filteredEvents`, coap 
`coapMethodRestrict` (coap, coaps, coap+tcp, coaps+tcp), aws2-athena `retry`, 
and the jsonpath `option`. ehcache, jcache and aws2-athena now trim the values, 
as coap and jsonpath already did, so `CREATED, UPDATED` works at runtime too.
   - **http `authMethod`:** its description said it takes a comma-separated 
list, but the component uses one value (Basic, Bearer or NTLM). The description 
is fixed.
   
   For tools that read the catalog, such as Kaoto: an option with `"multiEnum": 
true` can be shown as a multi-select, and its value is the selected values 
joined with a comma.
   
   ## Tests
   
   - `JsonMapperTest`: the flag is written and read back, and only for the 
option that has it.
   - `SchemaGeneratorMojoMultiEnumTest`: the EIP model generator copies the 
flag, and ignores it without enums.
   - `CamelCatalogTest.testValidateMultiEnum`: lists of ehcache, jcache and 
coap validate, a wrong value is reported, a single-value option still rejects a 
list, and spaces are allowed in a property file.
   - `YamlValidatorTest.testMultiEnumOption`: the jsonpath option takes one 
value, a list, and a list with spaces, and a wrong value gets the hint with the 
values.
   - `CatalogDocsTest`: ehcache `eventTypes` says that several values can be 
set, and consul `action` does not.
   - On a full reactor build into a private Maven repository, the tests pass 
for: camel-tooling-model (27), camel-package-maven-plugin (89), camel-catalog 
(1103), camel-yaml-dsl (483), camel-yaml-dsl-validator (241), camel-jbang-core 
(2512), camel-jbang-mcp (503), and the five components: ehcache (73), jcache 
(91), coap (76), aws2-athena (52) and jsonpath (133).
   
   Generated files: the component, model and language JSON, the catalog copies, 
the YAML deserializers and schemas, and the endpoint DSL. In 
`camelYamlDsl-model.json` I kept only the change for the jsonpath option. A 
full regeneration on my machine also added catalog details to 188 attributes 
that main does not have, which looks like the last regeneration used an older 
catalog. That is left out of this PR.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
   


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