liunaijie opened a new issue, #10591: URL: https://github.com/apache/seatunnel/issues/10591
### Search before asking - [x] I had searched in the [feature](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22Feature%22) and found no similar feature requirement. ### Description # Improve OptionRule to Support Nested Rules Currently we use `OptionRule` to describe the parameter relationships of a Connector, such as: - which parameters are required - which parameters are optional - which parameters are mutually exclusive However, the current design has several limitations. # Limitations 1. Difficult to express complex parameter relationships In some complex scenarios, it is hard to clearly describe parameter dependencies using the current OptionRule structure. 2. Poor reusability across connectors When we introduce a new parameter that is shared by multiple connectors (for example, a parameter for text format used in `HdfsFile`, `CosFile`, `OssFile`, etc.), we need to update the OptionRule definition in every connector, which leads to duplicated logic and higher maintenance cost. # Proposed Improvement Support nested OptionRule definitions, so that rules can be defined once and reused in multiple connectors. For example: ``` // defined in Parquet class OptionRule parquetRule = OptionRule.builder() ... // define parquet-related rules .build(); // defined in Csv class OptionRule csvRule = OptionRule.builder() ... // define csv-related rules .build(); // defined in ConnectorFactory //// defined a sub case OptionRule subRule = OptionRule.builder().build(); OptionRule connectorRule = OptionRule.builder() .required(xxx) .conditionalRule(option_a, "valueA", subRule) .conditionalRule(file_format, "parquet", parquetRule) .conditionalRule(file_format, "csv", csvRule) .build(); ``` With this approach: Parameter rules can be **modularized and reused** Connector factories only need to **compose existing rules** Maintenance cost is reduced when shared parameters are introduced or modified ### Usage Scenario _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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]
