nzw921rx opened a new pull request, #11022:
URL: https://github.com/apache/seatunnel/pull/11022

   ### Purpose of this pull request
   
   Allow `exclusive()`/`bundled()` options to coexist with `optional(Option, 
Condition)` value constraints in `OptionRule.Builder`.
   
   **Problem:**
   
   `OptionRule.Builder` treated `exclusive`/`bundled` and `optional` as 
mutually exclusive registrations. When a connector (e.g. MongoDB CDC) declared 
`exclusive(SCHEMA, TABLE_CONFIGS)`, adding `optional(SCHEMA, 
Conditions.mapNotEmpty(SCHEMA))` threw:
   ```
   OptionsOption 'schema' duplicate in 'ExclusiveRequiredOptions'
   ```
   This forced connectors to keep imperative `if/throw` checks for value 
validation that should be declarative.
   
   **Fix:**
   
   Modified `verifyOptionOptionsDuplicate` to skip duplicate checks for 
`ExclusiveRequiredOptions` and `BundledRequiredOptions`. These structural 
constraints (presence/exclusivity) are orthogonal to value constraints (content 
validation). The `required` + `optional` conflict check remains unchanged.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Unit tests in `OptionRuleTest.testVerify()` and `ConfigValidatorTest`:
   - `exclusive` + `optional(condition)` — builds and validates correctly
   - `bundled` + `optional(condition)` — builds and validates correctly
   - `required` + `optional` — still fails (unchanged behavior)
   - Duplicate `optional` — still fails (unchanged behavior)
   - Full runtime validation: exclusive check, value constraint check, combined 
scenarios
   
   ```bash
   ./mvnw -pl seatunnel-api test
   ```
   


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