Dhairya-007 opened a new pull request, #30059:
URL: https://github.com/apache/camel/pull/30059
## Problem
`CamelHashicorpVaultProducerOperation` overrides the `operation` endpoint
option per exchange, and the producer reads it as the enum:
```java
private HashicorpVaultOperation determineOperation(Exchange exchange) {
HashicorpVaultOperation operation
= exchange.getIn().getHeader(HashicorpVaultConstants.OPERATION,
HashicorpVaultOperation.class);
if (operation == null) {
operation = getConfiguration().getOperation();
}
return operation;
}
```
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.hashicorp.vault.HashicorpVaultOperation",
"enum": [ "createSecret", "getSecret", "deleteSecret",
"listSecrets" ] }
```
while the header entry next to it says:
```json
"CamelHashicorpVaultProducerOperation": { ..., "javaType": "String", ... }
```
So the four accepted values are discoverable through the URI option but not
through the header, even though the header is the same choice made per message
- and the header is the only way to vary it. A wrong value is not reported as
such either: the conversion yields `null` and the producer silently 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.hashicorp.vault.HashicorpVaultOperation or String",
enums = "createSecret,getSecret,deleteSecret,listSecrets")
```
`... 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 `hashicorp-vault.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]