martinweiler opened a new pull request, #7199:
URL: https://github.com/apache/incubator-kie/pull/7199

   **PR description**
   
   ## [kie-issues#7198] Support undeclared process variables
   
   Adds an opt-in legacy mode that lets a process accept variables that aren't 
declared in the BPMN, restoring the earlier behavior. It's controlled by 
`kogito.workflow.variable-legacy-mode` and defaults to `false`.
   
   ### Changes
   
   - **Config flag:** `kogito.workflow.variable-legacy-mode` is exposed as a 
Quarkus runtime config (`KogitoWorkflowRuntimeConfig`) and a Spring `@Value`. 
Both `KogitoBeanProducer` classes apply it at startup.
   - **`VariableLegacyMode` (new, `kogito-api`):** a small holder for the 
runtime flag. `Models` is in `kogito-api` and can't depend on `jbpm-flow`, so 
it reads the flag from here. `VariableScope.validateVariable`, 
`AbstractProcessInstance` and the bean producers use it too. It replaces the 
earlier approach of reading a system property.
   - **`Model` API:** new default methods `getAdditionalProperties()` and 
`setAdditionalProperties(Map)`, with `@JsonIgnore` on the getter. The default 
getter returns an empty map and the default setter does nothing. The generated 
model templates (`ModelTemplate`, `ModelNoIDTemplate`) override them to carry 
the extra values. This avoids reflection in `Models` and 
`AbstractProcessInstance`.
   - **Codegen:**
     - `ModelNoIDTemplate` collects unknown JSON properties through 
`@JsonAnySetter`/`@JsonAnyGetter`.
     - `ProcessToExecModelGenerator` forwards them from the Input model to the 
target model.
     - `ModelMetaData` includes them in the generated `toMap`.
   - **Runtime:** when the flag is on, `Models.toMap`/`fromMap` and 
`AbstractProcessInstance.bind`/`unbind` merge the undeclared values in and out 
of the process variable map.
   - **Tests:**
     - `UndeclaredVariableIT` (Quarkus) and `UndeclaredVariableTest` (Spring 
Boot) use a new `undeclared-variable.bpmn`. They start a process with an 
undeclared `payload` and check that the instance stays active.
     - The integration-test `application.properties` files set the flag.
   
   ### Notes
   - Behavior is unchanged when the flag is off.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to