Thomas Raddatz created CAMEL-25498:
--------------------------------------

             Summary: camel-jbang - Export to Quarkus dashes upper-case letters 
in quarkus.* property keys, which breaks names such as log categories and named 
datasources
                 Key: CAMEL-25498
                 URL: https://issues.apache.org/jira/browse/CAMEL-25498
             Project: Camel
          Issue Type: Bug
          Components: camel-jbang
    Affects Versions: 4.22.1
            Reporter: Thomas Raddatz


{{camel export \-\-runtime=quarkus}} writes every {{quarkus.*}} key except 
{{quarkus.hawtio.*}} through {{StringHelper.camelCaseToDash}} 
({{ExportQuarkus.applicationPropertyLine}}). Each upper-case letter becomes a 
dash and the lower-case letter, also in segments that are names chosen by the 
user rather than Quarkus option names, and inside quoted segments. Quarkus 
takes such names literally, so the exported application gets other names than 
the project defines. Keys from the project's {{application.properties}} and 
from {{\-\-prop}} are affected alike.

h3. Reproduction (Camel CLI 4.22.1)

{code:bash}
camel init hello.camel.yaml
camel export hello.camel.yaml --runtime=quarkus --gav=org.example:hello:1.0.0 
--dir=out \
  '--prop=quarkus.swagger-ui.urls.Camel=../openapi.json' \
  '--prop=quarkus.log.category."com.example.MyRoute".level=DEBUG' \
  '--prop=quarkus.datasource.Orders.db-kind=postgresql'
grep -E 'swagger-ui|log.category|datasource' 
out/src/main/resources/application.properties
{code}

{noformat}
quarkus.swagger-ui.urls.-camel=../openapi.json
quarkus.log.category."com.example.-my-route".level=DEBUG
quarkus.datasource.-orders.db-kind=postgresql
{noformat}

So the Swagger UI URL is named {{-camel}} instead of overriding the {{Camel}} 
entry that Camel Quarkus registers, the log level is set for a category 
{{com.example.-my-route}} that no logger uses, and the datasource is named 
{{-orders}} instead of {{Orders}}.

{{camel.*}} keys go through the same conversion without harm, because Camel's 
property binding turns the dashes back ({{MainHelper.optionKey}}).

h3. History

The conversion came with CAMEL-18322, when the export stored kebab-case keys in 
camel case ({{CamelCaseOrderedProperties.doPut}} called {{dashToCamelCase}}) 
and the Quarkus keys had to be turned back. Commit b7a4e868c172 ("camel-jbang - 
Do not change keys in application.properties when exporting.") removed that a 
few days later, so the keys have been read as written since, but the conversion 
stayed. CAMEL-22139 ("Export to Quarkus should let property keys with their 
current case") then excluded {{quarkus.hawtio.*}}, whose option names are camel 
case.

h3. Proposal

Write {{quarkus.*}} keys as they are given, as the title of CAMEL-22139 
suggests; Quarkus option names are kebab case already. If camel-case Quarkus 
option names written by users should still be converted, convert only 
lower-to-upper transitions and leave quoted segments and segments that start 
with an upper-case letter as they are.

The workaround is to append such keys to the exported 
{{application.properties}} after the export.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to