Dhairya-007 opened a new pull request, #30061:
URL: https://github.com/apache/camel/pull/30061

   ## Problem
   
   `CamelIbmSecretsManagerProducerOperation` overrides the `operation` endpoint 
option per exchange, and the producer reads it as the enum:
   
   ```java
   IBMSecretsManagerOperation operation
           = exchange.getIn().getHeader(IBMSecretsManagerConstants.OPERATION, 
IBMSecretsManagerOperation.class);
   ```
   
   The header is documented as a plain `String` with no value list:
   
   ```java
   @Metadata(label = "producer", description = "Overrides the desired operation 
to be used in the producer.",
             javaType = "String")
   public static final String OPERATION = HEADER_PREFIX + "ProducerOperation";
   ```
   
   The option it overrides is documented properly, because its field is typed:
   
   ```json
   "operation": { ..., "javaType": 
"org.apache.camel.component.ibm.secrets.manager.IBMSecretsManagerOperation",
                  "enum": [ "createArbitrarySecret", "createKVSecret", 
"getSecret", "deleteSecret",
                            "listSecrets", "updateSecret", "listSecretVersions" 
] }
   ```
   
   while the header entry says only:
   
   ```json
   "CamelIbmSecretsManagerProducerOperation": { ..., "javaType": "String", ... }
   ```
   
   So the seven accepted values are discoverable through the URI option but not 
through the header, although the header is the same choice made per message. 
Names like `createArbitrarySecret` and `listSecretVersions` are not guessable, 
and a wrong value is not reported: the conversion yields `null` and the 
producer falls back to the configured operation.
   
   ## Fix
   
   Document the header the way the option is documented - name the enum, and 
list its constants:
   
   ```java
   javaType = 
"org.apache.camel.component.ibm.secrets.manager.IBMSecretsManagerOperation or 
String",
   enums = 
"createArbitrarySecret,createKVSecret,getSecret,deleteSecret,listSecrets,updateSecret,"
           + "listSecretVersions")
   ```
   
   `... or String` is the existing Camel convention for a header that takes an 
enum or its name (`MongoDbConstants.OPERATION_HEADER`, 
`SpiffeConstants.OPERATION`). Metadata only - no behaviour change.
   
   The regenerated `ibm-secrets-manager.json` files are included.
   


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