Dhairya-007 opened a new pull request, #29963:
URL: https://github.com/apache/camel/pull/29963
## Problem
`KeyVaultConstants` has three headers, and two of them declare a `javaType`
the producer does not use.
**`CamelAzureKeyVaultProducerOperation` names a class that does not exist.**
```java
@Metadata(label = "producer", description = "Overrides the desired operation
to be used in the producer.",
javaType =
"org.apache.camel.component.azure.key.vault.KeyVaultOperationDefinition")
public static final String OPERATION = HEADER_PREFIX + "ProducerOperation";
```
There is no `KeyVaultOperationDefinition` in the component, or anywhere else
in the tree - a grep finds the name only in this annotation and in the files
generated from it. The enum is `KeyVaultOperation`, which is what the producer
reads the header as:
```java
KeyVaultOperation operation =
exchange.getIn().getHeader(KeyVaultConstants.OPERATION,
KeyVaultOperation.class);
```
and what the `operation` endpoint option is typed as. The invented name
reached the catalog and the endpoint DSL, where it ends up in a `{@code}`
reference that resolves to nothing:
```java
/**
* Overrides the desired operation to be used in the producer.
*
* The option is a: {@code
* org.apache.camel.component.azure.key.vault.KeyVaultOperationDefinition}
type.
```
**`CamelAzureKeyVaultSecretProperties` is documented as `String`.**
```java
@Metadata(label = "producer", description = "The secret properties to be
used in Key Vault for updating a secret",
javaType = "String")
public static final String SECRET_PROPERTIES = HEADER_PREFIX +
"SecretProperties";
```
`updateSecretProperties` reads the Azure model class:
```java
final SecretProperties secretProperties
=
exchange.getMessage().getHeader(KeyVaultConstants.SECRET_PROPERTIES,
SecretProperties.class);
if (ObjectHelper.isEmpty(secretProperties)) {
throw new IllegalArgumentException(MISSING_SECRET_PROPERTIES);
}
```
There is no `String` to
`com.azure.security.keyvault.secrets.models.SecretProperties` converter, so
setting the header to the documented type makes `getHeader` return null and the
operation fail with "secret properties must be specified" - although they were
specified, as the header table said to. The component's own `bodyTypes`
description, in the same generated file, already describes it correctly:
"updateSecretProperties takes the SecretProperties from the
CamelAzureKeyVaultSecretProperties header".
## Fix
Declare the types the producer actually reads: `KeyVaultOperation` and
`com.azure.security.keyvault.secrets.models.SecretProperties`.
Nothing in the runtime path changes - only the metadata and what is
generated from it, so the catalog, the header table and the endpoint DSL
javadoc now name real, usable types. The regenerated `azure-key-vault.json`
files and `KeyVaultEndpointBuilderFactory` 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]