apache / apache/airflow

Validate templated field assigned also in super constructor

Open
#37,216 1 comment 0 reactions 0 assignees View on GitHub
area:dev-tools kind:feature
Dominant language
Python
Stars
46.9k
Forks
17.8k
Avg merge
2d 7h
Merged PRs (30d)
484

Description

### Description

the issue is follow up of this pr: https://github.com/apache/airflow/pull/33786 that add the abilty to checks for the templated field "invalid logic" within the constructor of providers' operators.
the issue comes from https://github.com/apache/airflow/blob/8961bab6b2ed387bea1193fb3199a1c56ba4455c/scripts/ci/pre_commit/pre_commit_validate_operators_init.py#L176
and it will add the ability to validate assignment of templated field in super constructor.

### Use case/motivation

this issue will close pr's like this https://github.com/apache/airflow/pull/36789 and will prevent similar errors like from this pr https://github.com/apache/airflow/issues/35278.
and probably will solve errors from this list https://github.com/apache/airflow/issues/36484

### Related issues

https://github.com/apache/airflow/issues/36484
https://github.com/apache/airflow/issues/29069

### Are you willing to submit a PR?

- [ ] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Research direction

Start with scripts/ci/pre_commit/pre_commit_validate_operators_init.py around line 176 and review pull request 33786 to understand the existing templated-field validation. Use the related pull requests and issues as examples, then verify that assignments made through a super constructor are validated and the cited invalid patterns are detected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.