Dhairya-007 opened a new pull request, #30076:
URL: https://github.com/apache/camel/pull/30076
## Problem
### 1. Eleven header `javaType` values are unqualified, and three of them
silently cost the header its value list
```java
@Metadata(label = "producer", description = "The state operation to perform
on the state store. " +
"Required for
DaprOperation.state operation",
javaType = "StateOperation", defaultValue = "get",
enums = "save, saveBulk, get, getBulk, delete, executeTransaction")
public static final String STATE_OPERATION = HEADER_PREFIX +
"StateOperation";
```
Fully qualified is the convention by a wide margin - across the whole
catalog, 3692 header `javaType` values are fully qualified or a built-in type,
and 151 are not.
Here it is not only a readability matter. The three operation headers each
declare an `enums` list, and none of those lists reached the catalog:
```json
"CamelDaprStateOperation": { ..., "javaType": "StateOperation",
"defaultValue": "get", ... }
"CamelDaprLockOperation": { ..., "javaType": "LockOperation",
"defaultValue": "tryLock", ... }
"CamelDaprWorkflowOperation": { ..., "javaType": "WorkflowOperation",
"defaultValue": "scheduleNew", ... }
```
No `enum` field at all. Qualifying the `javaType` is what makes the declared
`enums` take effect, so after this change the three publish their accepted
values - which is how the matching `stateOperation`, `lockOperation` and
`workflowOperation` URI options have always been documented.
`Duration`, `Instant` and `OffsetDateTime` are the other names worth
qualifying: all three are `java.time`, and `State` and
`TransactionalStateOperation` are Dapr's (`io.dapr.client.domain`) while
`StateOperation` is Camel's own - three similar names from two different places.
### 2. The workflow operation header documents one of nine operations
```java
enums = "scheduleNew")
public static final String WORKFLOW_OPERATION = HEADER_PREFIX +
"WorkflowOperation";
```
`WorkflowOperation` has nine constants and `DaprWorkflowHandler` dispatches
on all nine:
```java
switch (workflowOperation) {
case scheduleNew: return scheduleNewWorkflow(exchange,
client);
case terminate: return terminateWorkflow(exchange,
client);
case purge: return purgeWorkflow(exchange, client);
case suspend: return suspendWorkflow(exchange,
client);
case resume: return resumeWorkflow(exchange, client);
case state: return getWorkflowState(exchange,
client);
case waitForInstanceStart: return waitForInstanceStart(exchange,
client);
case waitForInstanceCompletion: return
waitForInstanceCompletion(exchange, client);
case raiseEvent: return raiseEvent(exchange, client);
```
The `workflowOperation` URI option lists all nine, because its field is
typed and the generator reads the enum. The header's list is hand-written and
was never extended past the first one, so eight working operations are
undocumented for the header - and the header is the only way to vary the
operation per exchange. The two sibling headers do list their enum's constants
in full, which is what makes this one stand out.
## Fix
Qualify the eleven `javaType` values, taking each FQN from the import the
module itself uses, and complete the `enums` list for `WORKFLOW_OPERATION` to
the nine constants the handler accepts, in the declaration order of the enum
and in the same comma-space style as the two sibling headers.
Metadata only - no behaviour change. I diffed the regenerated catalog file
against `main`: the only differences are the eleven `javaType` values and the
three `enum` lists appearing, with no header added or removed and no change to
the option sections.
--
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]