Vamsi-klu commented on PR #62657: URL: https://github.com/apache/airflow/pull/62657#issuecomment-4015681405
@pierrejeambrun Thanks for the suggestion! I've implemented exactly this approach: **`make_partial_model()` helper** in `base.py` — takes any Pydantic model and returns a subclass with all fields `Optional` (default `None`). It uses `create_model(__base__=OriginalModel)` so it preserves: - All field validators (e.g., `validate_extra` on `ConnectionBody`) - `model_config` (including `extra="forbid"` from `StrictBaseModel`) - Field metadata (aliases, max_length, pattern, etc.) **Partial models created:** - `ConnectionBodyPartial = make_partial_model(ConnectionBody)` - `VariableBodyPartial = make_partial_model(VariableBody)` - `DAGPatchBodyPartial = make_partial_model(DAGPatchBody)` **Validation logic:** When `update_mask` is provided → validate masked fields against partial model. When no `update_mask` → full model validation (unchanged). **Tests:** 346 existing tests pass + 11 new tests (8 for `make_partial_model` helper, 3 endpoint-level tests verifying partial validation preserves validators and `extra="forbid"`). -- 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]
