1# generated by datamodel-codegen:
2# filename: http://0.0.0.0:8080/execution/openapi.json
3# version: 0.33.0
4
5# Licensed to the Apache Software Foundation (ASF) under one
6# or more contributor license agreements. See the NOTICE file
7# distributed with this work for additional information
8# regarding copyright ownership. The ASF licenses this file
9# to you under the Apache License, Version 2.0 (the
10# "License"); you may not use this file except in compliance
11# with the License. You may obtain a copy of the License at
12#
13# http://www.apache.org/licenses/LICENSE-2.0
14#
15# Unless required by applicable law or agreed to in writing,
16# software distributed under the License is distributed on an
17# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18# KIND, either express or implied. See the License for the
19# specific language governing permissions and limitations
20# under the License.
21from __future__ import annotations
22
23from datetime import timedelta
24from enum import Enum
25from typing import Annotated, Any, Final, Literal
26from uuid import UUID
27
28from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, JsonValue, RootModel
29
30API_VERSION: Final[str] = "2026-03-31"
31
32
33class AssetAliasReferenceAssetEventDagRun(BaseModel):
34 """
35 Schema for AssetAliasModel used in AssetEventDagRunReference.
36 """
37
38 model_config = ConfigDict(
39 extra="forbid",
40 )
41 name: Annotated[str, Field(title="Name")]
42
43
44class AssetProfile(BaseModel):
45 """
46 Profile of an asset-like object.
47
48 Asset will have name, uri defined, with type set to 'Asset'.
49 AssetNameRef will have name defined, type set to 'AssetNameRef'.
50 AssetUriRef will have uri defined, type set to 'AssetUriRef'.
51 AssetAlias will have name defined, type set to 'AssetAlias'.
52
53 Note that 'type' here is distinct from 'asset_type' the user declares on an
54 Asset (or subclass). This field is for distinguishing between different
55 asset-related types (Asset, AssetRef, or AssetAlias).
56 """
57
58 model_config = ConfigDict(
59 extra="forbid",
60 )
61 name: Annotated[str | None, Field(title="Name")] = None
62 uri: Annotated[str | None, Field(title="Uri")] = None
63 type: Annotated[str, Field(title="Type")]
64
65
66class ConnectionResponse(BaseModel):
67 """
68 Connection schema for responses with fields that are needed for Runtime.
69 """
70
71 conn_id: Annotated[str, Field(title="Conn Id")]
72 conn_type: Annotated[str, Field(title="Conn Type")]
73 host: Annotated[str | None, Field(title="Host")] = None
74 schema_: Annotated[str | None, Field(alias="schema", title="Schema")] = None
75 login: Annotated[str | None, Field(title="Login")] = None
76 password: Annotated[str | None, Field(title="Password")] = None
77 port: Annotated[int | None, Field(title="Port")] = None
78 extra: Annotated[str | None, Field(title="Extra")] = None
79
80
81class DagRunAssetReference(BaseModel):
82 """
83 DagRun serializer for asset responses.
84 """
85
86 model_config = ConfigDict(
87 extra="forbid",
88 )
89 run_id: Annotated[str, Field(title="Run Id")]
90 dag_id: Annotated[str, Field(title="Dag Id")]
91 logical_date: Annotated[AwareDatetime | None, Field(title="Logical Date")] = None
92 start_date: Annotated[AwareDatetime, Field(title="Start Date")]
93 end_date: Annotated[AwareDatetime | None, Field(title="End Date")] = None
94 state: Annotated[str, Field(title="State")]
95 data_interval_start: Annotated[AwareDatetime | None, Field(title="Data Interval Start")] = None
96 data_interval_end: Annotated[AwareDatetime | None, Field(title="Data Interval End")] = None
97
98
99class DagRunState(str, Enum):
100 """
101 All possible states that a DagRun can be in.
102
103 These are "shared" with TaskInstanceState in some parts of the code,
104 so please ensure that their values always match the ones with the
105 same name in TaskInstanceState.
106 """
107
108 QUEUED = "queued"
109 RUNNING = "running"
110 SUCCESS = "success"
111 FAILED = "failed"
112
113
114class DagRunStateResponse(BaseModel):
115 """
116 Schema for DAG Run State response.
117 """
118
119 state: DagRunState
120
121
122class DagRunType(str, Enum):
123 """
124 Class with DagRun types.
125 """
126
127 BACKFILL = "backfill"
128 SCHEDULED = "scheduled"
129 MANUAL = "manual"
130 ASSET_TRIGGERED = "asset_triggered"
131
132
133class HITLUser(BaseModel):
134 """
135 Schema for a Human-in-the-loop users.
136 """
137
138 id: Annotated[str, Field(title="Id")]
139 name: Annotated[str, Field(title="Name")]
140
141
142class InactiveAssetsResponse(BaseModel):
143 """
144 Response for inactive assets.
145 """
146
147 inactive_assets: Annotated[list[AssetProfile] | None, Field(title="Inactive Assets")] = None
148
149
150class IntermediateTIState(str, Enum):
151 """
152 States that a Task Instance can be in that indicate it is not yet in a terminal or running state.
153 """
154
155 SCHEDULED = "scheduled"
156 QUEUED = "queued"
157 RESTARTING = "restarting"
158 UP_FOR_RETRY = "up_for_retry"
159 UP_FOR_RESCHEDULE = "up_for_reschedule"
160 DEFERRED = "deferred"
161
162
163class PrevSuccessfulDagRunResponse(BaseModel):
164 """
165 Schema for response with previous successful DagRun information for Task Template Context.
166 """
167
168 data_interval_start: Annotated[AwareDatetime | None, Field(title="Data Interval Start")] = None
169 data_interval_end: Annotated[AwareDatetime | None, Field(title="Data Interval End")] = None
170 start_date: Annotated[AwareDatetime | None, Field(title="Start Date")] = None
171 end_date: Annotated[AwareDatetime | None, Field(title="End Date")] = None
172
173
174class PreviousTIResponse(BaseModel):
175 """
176 Schema for response with previous TaskInstance information.
177 """
178
179 task_id: Annotated[str, Field(title="Task Id")]
180 dag_id: Annotated[str, Field(title="Dag Id")]
181 run_id: Annotated[str, Field(title="Run Id")]
182 logical_date: Annotated[AwareDatetime | None, Field(title="Logical Date")] = None
183 start_date: Annotated[AwareDatetime | None, Field(title="Start Date")] = None
184 end_date: Annotated[AwareDatetime | None, Field(title="End Date")] = None
185 state: Annotated[str | None, Field(title="State")] = None
186 try_number: Annotated[int, Field(title="Try Number")]
187 map_index: Annotated[int | None, Field(title="Map Index")] = -1
188 duration: Annotated[float | None, Field(title="Duration")] = None
189
190
191class TIDeferredStatePayload(BaseModel):
192 """
193 Schema for updating TaskInstance to a deferred state.
194 """
195
196 model_config = ConfigDict(
197 extra="forbid",
198 )
199 state: Annotated[Literal["deferred"] | None, Field(title="State")] = "deferred"
200 classpath: Annotated[str, Field(title="Classpath")]
201 trigger_kwargs: Annotated[dict[str, JsonValue] | str | None, Field(title="Trigger Kwargs")] = None
202 trigger_timeout: Annotated[timedelta | None, Field(title="Trigger Timeout")] = None
203 next_method: Annotated[str, Field(title="Next Method")]
204 next_kwargs: Annotated[dict[str, JsonValue] | None, Field(title="Next Kwargs")] = None
205 rendered_map_index: Annotated[str | None, Field(title="Rendered Map Index")] = None
206
207
208class TIEnterRunningPayload(BaseModel):
209 """
210 Schema for updating TaskInstance to 'RUNNING' state with minimal required fields.
211 """
212
213 model_config = ConfigDict(
214 extra="forbid",
215 )
216 state: Annotated[Literal["running"] | None, Field(title="State")] = "running"
217 hostname: Annotated[str, Field(title="Hostname")]
218 unixname: Annotated[str, Field(title="Unixname")]
219 pid: Annotated[int, Field(title="Pid")]
220 start_date: Annotated[AwareDatetime, Field(title="Start Date")]
221
222
223class TIHeartbeatInfo(BaseModel):
224 """
225 Schema for TaskInstance heartbeat endpoint.
226 """
227
228 model_config = ConfigDict(
229 extra="forbid",
230 )
231 hostname: Annotated[str, Field(title="Hostname")]
232 pid: Annotated[int, Field(title="Pid")]
233
234
235class TIRescheduleStatePayload(BaseModel):
236 """
237 Schema for updating TaskInstance to a up_for_reschedule state.
238 """
239
240 model_config = ConfigDict(
241 extra="forbid",
242 )
243 state: Annotated[Literal["up_for_reschedule"] | None, Field(title="State")] = "up_for_reschedule"
244 reschedule_date: Annotated[AwareDatetime, Field(title="Reschedule Date")]
245 end_date: Annotated[AwareDatetime, Field(title="End Date")]
246
247
248class TIRetryStatePayload(BaseModel):
249 """
250 Schema for updating TaskInstance to up_for_retry.
251 """
252
253 model_config = ConfigDict(
254 extra="forbid",
255 )
256 state: Annotated[Literal["up_for_retry"] | None, Field(title="State")] = "up_for_retry"
257 end_date: Annotated[AwareDatetime, Field(title="End Date")]
258 rendered_map_index: Annotated[str | None, Field(title="Rendered Map Index")] = None
259
260
261class TISkippedDownstreamTasksStatePayload(BaseModel):
262 """
263 Schema for updating downstream tasks to a skipped state.
264 """
265
266 model_config = ConfigDict(
267 extra="forbid",
268 )
269 tasks: Annotated[list[str | tuple[str, int]], Field(title="Tasks")]
270
271
272class TISuccessStatePayload(BaseModel):
273 """
274 Schema for updating TaskInstance to success state.
275 """
276
277 model_config = ConfigDict(
278 extra="forbid",
279 )
280 state: Annotated[Literal["success"] | None, Field(title="State")] = "success"
281 end_date: Annotated[AwareDatetime, Field(title="End Date")]
282 task_outlets: Annotated[list[AssetProfile] | None, Field(title="Task Outlets")] = None
283 outlet_events: Annotated[list[dict[str, Any]] | None, Field(title="Outlet Events")] = None
284 rendered_map_index: Annotated[str | None, Field(title="Rendered Map Index")] = None
285
286
287class TITargetStatePayload(BaseModel):
288 """
289 Schema for updating TaskInstance to a target state, excluding terminal and running states.
290 """
291
292 model_config = ConfigDict(
293 extra="forbid",
294 )
295 state: IntermediateTIState
296
297
298class TaskBreadcrumbsResponse(BaseModel):
299 """
300 Response for task breadcrumbs.
301 """
302
303 breadcrumbs: Annotated[list[dict[str, Any]], Field(title="Breadcrumbs")]
304
305
306class TaskInstanceState(str, Enum):
307 """
308 All possible states that a Task Instance can be in.
309
310 Note that None is also allowed, so always use this in a type hint with Optional.
311 """
312
313 REMOVED = "removed"
314 SCHEDULED = "scheduled"
315 QUEUED = "queued"
316 RUNNING = "running"
317 SUCCESS = "success"
318 RESTARTING = "restarting"
319 FAILED = "failed"
320 UP_FOR_RETRY = "up_for_retry"
321 UP_FOR_RESCHEDULE = "up_for_reschedule"
322 UPSTREAM_FAILED = "upstream_failed"
323 SKIPPED = "skipped"
324 DEFERRED = "deferred"
325
326
327class TaskStatesResponse(BaseModel):
328 """
329 Response for task states with run_id, task and state.
330 """
331
332 task_states: Annotated[dict[str, Any], Field(title="Task States")]
333
334
335class TerminalStateNonSuccess(str, Enum):
336 """
337 TaskInstance states that can be reported without extra information.
338 """
339
340 FAILED = "failed"
341 SKIPPED = "skipped"
342 REMOVED = "removed"
343 UPSTREAM_FAILED = "upstream_failed"
344
345
346class TriggerDAGRunPayload(BaseModel):
347 """
348 Schema for Trigger DAG Run API request.
349 """
350
351 model_config = ConfigDict(
352 extra="forbid",
353 )
354 logical_date: Annotated[AwareDatetime | None, Field(title="Logical Date")] = None
355 conf: Annotated[dict[str, Any] | None, Field(title="Conf")] = None
356 reset_dag_run: Annotated[bool | None, Field(title="Reset Dag Run")] = False
357
358
359class UpdateHITLDetailPayload(BaseModel):
360 """
361 Schema for writing the response part of a Human-in-the-loop detail for a specific task instance.
362 """
363
364 ti_id: Annotated[UUID, Field(title="Ti Id")]
365 chosen_options: Annotated[list[str], Field(min_length=1, title="Chosen Options")]
366 params_input: Annotated[dict[str, Any] | None, Field(title="Params Input")] = None
367
368
369class ValidationError(BaseModel):
370 loc: Annotated[list[str | int], Field(title="Location")]
371 msg: Annotated[str, Field(title="Message")]
372 type: Annotated[str, Field(title="Error Type")]
373
374
375class VariablePostBody(BaseModel):
376 """
377 Request body schema for creating variables.
378 """
379
380 model_config = ConfigDict(
381 extra="forbid",
382 )
383 val: Annotated[str | None, Field(title="Val")] = None
384 description: Annotated[str | None, Field(title="Description")] = None
385
386
387class VariableResponse(BaseModel):
388 """
389 Variable schema for responses with fields that are needed for Runtime.
390 """
391
392 model_config = ConfigDict(
393 extra="forbid",
394 )
395 key: Annotated[str, Field(title="Key")]
396 value: Annotated[str | None, Field(title="Value")] = None
397
398
399class XComResponse(BaseModel):
400 """
401 XCom schema for responses with fields that are needed for Runtime.
402 """
403
404 key: Annotated[str, Field(title="Key")]
405 value: JsonValue
406
407
408class XComSequenceIndexResponse(RootModel[JsonValue]):
409 root: Annotated[
410 JsonValue,
411 Field(
412 description="XCom schema with minimal structure for index-based access.",
413 title="XComSequenceIndexResponse",
414 ),
415 ]
416
417
418class XComSequenceSliceResponse(RootModel[list[JsonValue]]):
419 """
420 XCom schema with minimal structure for slice-based access.
421 """
422
423 root: Annotated[
424 list[JsonValue],
425 Field(
426 description="XCom schema with minimal structure for slice-based access.",
427 title="XComSequenceSliceResponse",
428 ),
429 ]
430
431
432class TaskInstance(BaseModel):
433 """
434 Schema for TaskInstance model with minimal required fields needed for Runtime.
435 """
436
437 id: Annotated[UUID, Field(title="Id")]
438 task_id: Annotated[str, Field(title="Task Id")]
439 dag_id: Annotated[str, Field(title="Dag Id")]
440 run_id: Annotated[str, Field(title="Run Id")]
441 try_number: Annotated[int, Field(title="Try Number")]
442 dag_version_id: Annotated[UUID, Field(title="Dag Version Id")]
443 map_index: Annotated[int | None, Field(title="Map Index")] = -1
444 hostname: Annotated[str | None, Field(title="Hostname")] = None
445 context_carrier: Annotated[dict[str, Any] | None, Field(title="Context Carrier")] = None
446
447
448class BundleInfo(BaseModel):
449 """
450 Schema for telling task which bundle to run with.
451 """
452
453 name: Annotated[str, Field(title="Name")]
454 version: Annotated[str | None, Field(title="Version")] = None
455
456
457class TerminalTIState(str, Enum):
458 SUCCESS = "success"
459 FAILED = "failed"
460 SKIPPED = "skipped"
461 UPSTREAM_FAILED = "upstream_failed"
462 REMOVED = "removed"
463
464
465class WeightRule(str, Enum):
466 DOWNSTREAM = "downstream"
467 UPSTREAM = "upstream"
468 ABSOLUTE = "absolute"
469
470
471class TriggerRule(str, Enum):
472 ALL_SUCCESS = "all_success"
473 ALL_FAILED = "all_failed"
474 ALL_DONE = "all_done"
475 ALL_DONE_MIN_ONE_SUCCESS = "all_done_min_one_success"
476 ALL_DONE_SETUP_SUCCESS = "all_done_setup_success"
477 ONE_SUCCESS = "one_success"
478 ONE_FAILED = "one_failed"
479 ONE_DONE = "one_done"
480 NONE_FAILED = "none_failed"
481 NONE_SKIPPED = "none_skipped"
482 ALWAYS = "always"
483 NONE_FAILED_MIN_ONE_SUCCESS = "none_failed_min_one_success"
484 ALL_SKIPPED = "all_skipped"
485
486
487class AssetReferenceAssetEventDagRun(BaseModel):
488 """
489 Schema for AssetModel used in AssetEventDagRunReference.
490 """
491
492 model_config = ConfigDict(
493 extra="forbid",
494 )
495 name: Annotated[str, Field(title="Name")]
496 uri: Annotated[str, Field(title="Uri")]
497 extra: Annotated[dict[str, JsonValue], Field(title="Extra")]
498
499
500class AssetResponse(BaseModel):
501 """
502 Asset schema for responses with fields that are needed for Runtime.
503 """
504
505 name: Annotated[str, Field(title="Name")]
506 uri: Annotated[str, Field(title="Uri")]
507 group: Annotated[str, Field(title="Group")]
508 extra: Annotated[dict[str, JsonValue] | None, Field(title="Extra")] = None
509
510
511class HITLDetailRequest(BaseModel):
512 """
513 Schema for the request part of a Human-in-the-loop detail for a specific task instance.
514 """
515
516 ti_id: Annotated[UUID, Field(title="Ti Id")]
517 options: Annotated[list[str], Field(min_length=1, title="Options")]
518 subject: Annotated[str, Field(title="Subject")]
519 body: Annotated[str | None, Field(title="Body")] = None
520 defaults: Annotated[list[str] | None, Field(title="Defaults")] = None
521 multiple: Annotated[bool | None, Field(title="Multiple")] = False
522 params: Annotated[dict[str, Any] | None, Field(title="Params")] = None
523 assigned_users: Annotated[list[HITLUser] | None, Field(title="Assigned Users")] = None
524
525
526class HITLDetailResponse(BaseModel):
527 """
528 Schema for the response part of a Human-in-the-loop detail for a specific task instance.
529 """
530
531 response_received: Annotated[bool, Field(title="Response Received")]
532 responded_by_user: HITLUser | None = None
533 responded_at: Annotated[AwareDatetime | None, Field(title="Responded At")] = None
534 chosen_options: Annotated[list[str] | None, Field(title="Chosen Options")] = None
535 params_input: Annotated[dict[str, Any] | None, Field(title="Params Input")] = None
536
537
538class HTTPValidationError(BaseModel):
539 detail: Annotated[list[ValidationError] | None, Field(title="Detail")] = None
540
541
542class TITerminalStatePayload(BaseModel):
543 """
544 Schema for updating TaskInstance to a terminal state except SUCCESS state.
545 """
546
547 model_config = ConfigDict(
548 extra="forbid",
549 )
550 state: TerminalStateNonSuccess
551 end_date: Annotated[AwareDatetime, Field(title="End Date")]
552 rendered_map_index: Annotated[str | None, Field(title="Rendered Map Index")] = None
553
554
555class AssetEventDagRunReference(BaseModel):
556 """
557 Schema for AssetEvent model used in DagRun.
558 """
559
560 model_config = ConfigDict(
561 extra="forbid",
562 )
563 asset: AssetReferenceAssetEventDagRun
564 extra: Annotated[dict[str, JsonValue], Field(title="Extra")]
565 source_task_id: Annotated[str | None, Field(title="Source Task Id")] = None
566 source_dag_id: Annotated[str | None, Field(title="Source Dag Id")] = None
567 source_run_id: Annotated[str | None, Field(title="Source Run Id")] = None
568 source_map_index: Annotated[int | None, Field(title="Source Map Index")] = None
569 source_aliases: Annotated[list[AssetAliasReferenceAssetEventDagRun], Field(title="Source Aliases")]
570 timestamp: Annotated[AwareDatetime, Field(title="Timestamp")]
571
572
573class AssetEventResponse(BaseModel):
574 """
575 Asset event schema with fields that are needed for Runtime.
576 """
577
578 id: Annotated[int, Field(title="Id")]
579 timestamp: Annotated[AwareDatetime, Field(title="Timestamp")]
580 extra: Annotated[dict[str, JsonValue] | None, Field(title="Extra")] = None
581 asset: AssetResponse
582 created_dagruns: Annotated[list[DagRunAssetReference], Field(title="Created Dagruns")]
583 source_task_id: Annotated[str | None, Field(title="Source Task Id")] = None
584 source_dag_id: Annotated[str | None, Field(title="Source Dag Id")] = None
585 source_run_id: Annotated[str | None, Field(title="Source Run Id")] = None
586 source_map_index: Annotated[int | None, Field(title="Source Map Index")] = None
587 partition_key: Annotated[str | None, Field(title="Partition Key")] = None
588
589
590class AssetEventsResponse(BaseModel):
591 """
592 Collection of AssetEventResponse.
593 """
594
595 asset_events: Annotated[list[AssetEventResponse], Field(title="Asset Events")]
596
597
598class DagRun(BaseModel):
599 """
600 Schema for DagRun model with minimal required fields needed for Runtime.
601 """
602
603 model_config = ConfigDict(
604 extra="forbid",
605 )
606 dag_id: Annotated[str, Field(title="Dag Id")]
607 run_id: Annotated[str, Field(title="Run Id")]
608 logical_date: Annotated[AwareDatetime | None, Field(title="Logical Date")] = None
609 data_interval_start: Annotated[AwareDatetime | None, Field(title="Data Interval Start")] = None
610 data_interval_end: Annotated[AwareDatetime | None, Field(title="Data Interval End")] = None
611 run_after: Annotated[AwareDatetime, Field(title="Run After")]
612 start_date: Annotated[AwareDatetime, Field(title="Start Date")]
613 end_date: Annotated[AwareDatetime | None, Field(title="End Date")] = None
614 clear_number: Annotated[int | None, Field(title="Clear Number")] = 0
615 run_type: DagRunType
616 state: DagRunState
617 conf: Annotated[dict[str, Any] | None, Field(title="Conf")] = None
618 triggering_user_name: Annotated[str | None, Field(title="Triggering User Name")] = None
619 consumed_asset_events: Annotated[list[AssetEventDagRunReference], Field(title="Consumed Asset Events")]
620 partition_key: Annotated[str | None, Field(title="Partition Key")] = None
621
622
623class TIRunContext(BaseModel):
624 """
625 Response schema for TaskInstance run context.
626 """
627
628 dag_run: DagRun
629 task_reschedule_count: Annotated[int | None, Field(title="Task Reschedule Count")] = 0
630 max_tries: Annotated[int, Field(title="Max Tries")]
631 variables: Annotated[list[VariableResponse] | None, Field(title="Variables")] = None
632 connections: Annotated[list[ConnectionResponse] | None, Field(title="Connections")] = None
633 upstream_map_indexes: Annotated[
634 dict[str, int | list[int] | None] | None, Field(title="Upstream Map Indexes")
635 ] = None
636 next_method: Annotated[str | None, Field(title="Next Method")] = None
637 next_kwargs: Annotated[dict[str, Any] | str | None, Field(title="Next Kwargs")] = None
638 xcom_keys_to_clear: Annotated[list[str] | None, Field(title="Xcom Keys To Clear")] = None
639 should_retry: Annotated[bool | None, Field(title="Should Retry")] = False