Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenAPI Spec fix nullable alongside $ref #32887

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def get_mapped_task_instances(
def _convert_ti_states(states: Iterable[str] | None) -> list[TaskInstanceState | None] | None:
if not states:
return None
return [None if s == "none" else TaskInstanceState(s) for s in states]
return [None if s in ("none", None) else TaskInstanceState(s) for s in states]


def _apply_array_filter(query: Select, key: ClauseElement, values: Iterable[Any] | None) -> Select:
Expand Down
17 changes: 9 additions & 8 deletions airflow/api_connexion/openapi/v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3228,7 +3228,6 @@ components:
items:
$ref: '#/components/schemas/Provider'


SLAMiss:
type: object
properties:
Expand Down Expand Up @@ -3256,6 +3255,7 @@ components:

Trigger:
type: object
nullable: true
properties:
id:
type: integer
Expand All @@ -3272,6 +3272,7 @@ components:

Job:
type: object
nullable: true
properties:
id:
type: integer
Expand Down Expand Up @@ -3335,7 +3336,6 @@ components:
nullable: true
state:
$ref: '#/components/schemas/TaskState'
nullable: true
try_number:
type: integer
map_index:
Expand Down Expand Up @@ -3371,7 +3371,6 @@ components:
type: string
sla_miss:
$ref: '#/components/schemas/SLAMiss'
nullable: true
rendered_fields:
description: |
JSON object describing rendered fields.
Expand All @@ -3380,10 +3379,8 @@ components:
type: object
trigger:
$ref: '#/components/schemas/Trigger'
nullable: true
triggerer_job:
$ref: '#/components/schemas/Job'
nullable: true
note:
type: string
description: |
Expand Down Expand Up @@ -3561,7 +3558,6 @@ components:

*Changed in version 2.0.1*: Field becomes nullable.
dag_run_timeout:
nullable: true
$ref: '#/components/schemas/TimeDelta'
doc_md:
type: string
Expand Down Expand Up @@ -3699,10 +3695,8 @@ components:
readOnly: true
execution_timeout:
$ref: '#/components/schemas/TimeDelta'
nullable: true
retry_delay:
$ref: '#/components/schemas/TimeDelta'
nullable: true
retry_exponential_backoff:
type: boolean
readOnly: true
Expand Down Expand Up @@ -4506,6 +4500,7 @@ components:
TimeDelta:
description: Time delta
type: object
nullable: true
required:
- __type
- days
Expand Down Expand Up @@ -4646,8 +4641,14 @@ components:

*Changed in version 2.4.0*: 'sensing' state has been removed.
*Changed in version 2.4.2*: 'restarting' is added as a possible value

*Changed in version 2.7.0*: Field becomes nullable and null primitive is added as a possible value.
*Changed in version 2.7.0*: 'none' state is deprecated in favor of null.

type: string
nullable: true
pierrejeambrun marked this conversation as resolved.
Show resolved Hide resolved
enum:
- null
- success
- running
- failed
Expand Down
2 changes: 1 addition & 1 deletion airflow/api_connexion/schemas/task_instance_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class TaskInstanceBatchFormSchema(Schema):
end_date_lte = fields.DateTime(load_default=None, validate=validate_istimezone)
duration_gte = fields.Int(load_default=None)
duration_lte = fields.Int(load_default=None)
state = fields.List(fields.Str(), load_default=None)
state = fields.List(fields.Str(allow_none=True), load_default=None)
pool = fields.List(fields.Str(), load_default=None)
queue = fields.List(fields.Str(), load_default=None)

Expand Down
55 changes: 31 additions & 24 deletions airflow/www/static/js/types/api-generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,7 @@ export interface components {
/** Format: datetime */
created_date?: string;
triggerer_id?: number | null;
};
} | null;
Job: {
id?: number;
dag_id?: string | null;
Expand All @@ -1320,7 +1320,7 @@ export interface components {
executor_class?: string | null;
hostname?: string | null;
unixname?: string | null;
};
} | null;
TaskInstance: {
task_id?: string;
dag_id?: string;
Expand All @@ -1337,7 +1337,7 @@ export interface components {
/** Format: datetime */
end_date?: string | null;
duration?: number | null;
state?: components["schemas"]["TaskState"] | null;
state?: components["schemas"]["TaskState"];
try_number?: number;
map_index?: number;
max_tries?: number;
Expand All @@ -1352,15 +1352,15 @@ export interface components {
queued_when?: string | null;
pid?: number | null;
executor_config?: string;
sla_miss?: components["schemas"]["SLAMiss"] | null;
sla_miss?: components["schemas"]["SLAMiss"];
/**
* @description JSON object describing rendered fields.
*
* *New in version 2.3.0*
*/
rendered_fields?: { [key: string]: unknown };
trigger?: components["schemas"]["Trigger"] | null;
triggerer_job?: components["schemas"]["Job"] | null;
trigger?: components["schemas"]["Trigger"];
triggerer_job?: components["schemas"]["Job"];
/**
* @description Contains manually entered notes by the user about the TaskInstance.
*
Expand Down Expand Up @@ -1460,7 +1460,7 @@ export interface components {
* *Changed in version 2.0.1*: Field becomes nullable.
*/
start_date?: string | null;
dag_run_timeout?: components["schemas"]["TimeDelta"] | null;
dag_run_timeout?: components["schemas"]["TimeDelta"];
doc_md?: string | null;
default_view?: string;
/**
Expand Down Expand Up @@ -1535,8 +1535,8 @@ export interface components {
queue?: string | null;
pool?: string;
pool_slots?: number;
execution_timeout?: components["schemas"]["TimeDelta"] | null;
retry_delay?: components["schemas"]["TimeDelta"] | null;
execution_timeout?: components["schemas"]["TimeDelta"];
retry_delay?: components["schemas"]["TimeDelta"];
retry_exponential_backoff?: boolean;
priority_weight?: number;
weight_rule?: components["schemas"]["WeightRule"];
Expand Down Expand Up @@ -2059,7 +2059,7 @@ export interface components {
days: number;
seconds: number;
microseconds: number;
};
} | null;
/** @description Relative delta */
RelativeDelta: {
__type: string;
Expand Down Expand Up @@ -2134,22 +2134,29 @@ export interface components {
* *Changed in version 2.4.0*: 'sensing' state has been removed.
* *Changed in version 2.4.2*: 'restarting' is added as a possible value
*
* @enum {string}
* *Changed in version 2.7.0*: Field becomes nullable and null primitive is added as a possible value.
* *Changed in version 2.7.0*: 'none' state is deprecated in favor of null.
*
* @enum {string|null}
*/
TaskState:
| "success"
| "running"
| "failed"
| "upstream_failed"
| "skipped"
| "up_for_retry"
| "up_for_reschedule"
| "queued"
| "none"
| "scheduled"
| "deferred"
| "removed"
| "restarting";
| (
| null
| "success"
| "running"
| "failed"
| "upstream_failed"
| "skipped"
| "up_for_retry"
| "up_for_reschedule"
| "queued"
| "none"
| "scheduled"
| "deferred"
| "removed"
| "restarting"
)
| null;
/**
* @description DAG State.
*
Expand Down