Thanks for the review! Replies inline: 1. Operator set scope
Agree — the current set is on the larger side. Will keep a compact core operator set (stable contract) and leave room for extended operators via future syntactic-sugar helpers without polluting the core API. 2. Backward compatibility Fully compatible via method overloading: // Existing (unchanged) public Builder required(@NonNull Option<?>... options) // New overload (opt-in) public Builder required(@NonNull Option<?> option, @NonNull Condition<?> condition, @NonNull Condition<?>... conditions) Zero migration needed. 3. Error message quality Will add a dedicated section in the STIP doc specifying structured error output: which option, which constraint, expected vs actual. Engine-agnostic `ValidationResult` consumed uniformly by Zeta/Flink/Spark. 4. Cross-field eval timing Purely config-parse time, before task submission. These are user-specified static values, not runtime variables. Catches bad configs early, avoids "job created but fails at runtime." --- Will update the STIP-28 doc with these details. Thanks! David Zollo <[email protected]> 于2026年6月1日周一 21:45写道: > Thanks for putting together such a thorough proposal — the audit of the 8 > validation categories across the connector modules is really valuable, and > I agree this is a real pain point. Today the scattered if/else validation > in Config.java is invisible to the REST API, Web UI, CLI --check, and > AI-assisted config generation, so making these constraints declarative and > machine-readable is a clear win. > > I went through the issue (#10976) and the reference PR (#10977). A few > thoughts and questions before this becomes a formal STIP: > > 1. > > *Scope of the operator set.* 30 operators in ConditionOperator is fairly > large. Could we group them into a small set of "core" operators that we > commit to long-term stability for, vs. more specialized ones? This helps > keep the API surface manageable and the documentation clear. > 2. > > *Backward compatibility.* Since optionRule() and Condition are already > widely used across connectors, could you clarify how the new Builder > overloads coexist with the existing presence-only checks? Ideally > existing > connectors should compile and behave unchanged with zero migration > required. > 3. > > *Error message quality.* One of the biggest benefits of declarative > constraints is consistent, user-friendly error messages. It would be > great > if the design specified how ConfigValidator surfaces failures (e.g. > which option, which constraint, expected vs. actual value), so the UX is > uniform across engines. > 4. > > *Cross-field constraints across engines.* For cross-field comparisons > like start_ts < end_ts, how is evaluation handled when values are > resolved at different stages (e.g. placeholders / runtime variables)? It > would help to clarify whether validation happens purely at config-parse > time. > > Overall +1 on the direction. I think formalizing this as STIP-28 makes > sense; happy to review the design doc in more detail once it's up. > > > > Best Regards, > David > Linkedin: https://www.linkedin.com/in/davidzollo > > > > On Sat, May 30, 2026 at 11:59 PM zhiwei niu <[email protected]> wrote: > > > Hi community, > > > > I'd like to propose STIP-28: Enhance the OptionRule API to support > > declarative > > value constraints beyond the current presence-only checks. > > > > Problem: > > Today, optionRule() can only express "option X is > > required/optional/exclusive/ > > conditional". It cannot express "port must be > 0", "start_ts < end_ts", > or > > "database name must be uppercase". This forces connector developers to > > scatter > > if/else validation in *Config.java — invisible to REST API, Web UI, CLI > > --check, > > and AI-assisted config generation. > > > > After auditing all connector modules, I found 8 categories of validation > > (numeric range, cross-field comparison, string format, string length, > case > > constraints, collection constraints, conditional value checks, mutual > > exclusion) > > that are currently implemented imperatively across dozens of connectors. > > > > Proposed solution: > > Extend the existing OptionRule + Condition system with a > ConditionOperator > > enum > > (30 operators) and new Builder overloads, so these constraints become > > declarative, > > machine-readable, and automatically enforced by ConfigValidator across > all > > engines. > > > > Full analysis and design: > > https://github.com/apache/seatunnel/issues/10976 > > > > Reference implementation: > > https://github.com/apache/seatunnel/pull/10977 > > > > I plan to formalize this as STIP-28 once I get initial feedback. > > Any thoughts or concerns are welcome. > > > > Best regards, > > Zhiwei Niu > > >
