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 queue: Annotated[str | None, Field(title="Queue")] = None
204 next_method: Annotated[str, Field(title="Next Method")]
205 next_kwargs: Annotated[dict[str, JsonValue] | None, Field(title="Next Kwargs")] = None
206 rendered_map_index: Annotated[str | None, Field(title="Rendered Map Index")] = None
207
208
209class TIEnterRunningPayload(BaseModel):
210 """
211 Schema for updating TaskInstance to 'RUNNING' state with minimal required fields.
212 """
213
214 model_config = ConfigDict(
215 extra="forbid",
216 )
217 state: Annotated[Literal["running"] | None, Field(title="State")] = "running"
218 hostname: Annotated[str, Field(title="Hostname")]
219 unixname: Annotated[str, Field(title="Unixname")]
220 pid: Annotated[int, Field(title="Pid")]
221 start_date: Annotated[AwareDatetime, Field(title="Start Date")]
222
223
224class TIHeartbeatInfo(BaseModel):
225 """
226 Schema for TaskInstance heartbeat endpoint.
227 """
228
229 model_config = ConfigDict(
230 extra="forbid",
231 )
232 hostname: Annotated[str, Field(title="Hostname")]
233 pid: Annotated[int, Field(title="Pid")]
234
235
236class TIRescheduleStatePayload(BaseModel):
237 """
238 Schema for updating TaskInstance to a up_for_reschedule state.
239 """
240
241 model_config = ConfigDict(
242 extra="forbid",
243 )
244 state: Annotated[Literal["up_for_reschedule"] | None, Field(title="State")] = "up_for_reschedule"
245 reschedule_date: Annotated[AwareDatetime, Field(title="Reschedule Date")]
246 end_date: Annotated[AwareDatetime, Field(title="End Date")]
247
248
249class TIRetryStatePayload(BaseModel):
250 """
251 Schema for updating TaskInstance to up_for_retry.
252 """
253
254 model_config = ConfigDict(
255 extra="forbid",
256 )
257 state: Annotated[Literal["up_for_retry"] | None, Field(title="State")] = "up_for_retry"
258 end_date: Annotated[AwareDatetime, Field(title="End Date")]
259 rendered_map_index: Annotated[str | None, Field(title="Rendered Map Index")] = None
260
261
262class TISkippedDownstreamTasksStatePayload(BaseModel):
263 """
264 Schema for updating downstream tasks to a skipped state.
265 """
266
267 model_config = ConfigDict(
268 extra="forbid",
269 )
270 tasks: Annotated[list[str | tuple[str, int]], Field(title="Tasks")]
271
272
273class TISuccessStatePayload(BaseModel):
274 """
275 Schema for updating TaskInstance to success state.
276 """
277
278 model_config = ConfigDict(
279 extra="forbid",
280 )
281 state: Annotated[Literal["success"] | None, Field(title="State")] = "success"
282 end_date: Annotated[AwareDatetime, Field(title="End Date")]
283 task_outlets: Annotated[list[AssetProfile] | None, Field(title="Task Outlets")] = None
284 outlet_events: Annotated[list[dict[str, Any]] | None, Field(title="Outlet Events")] = None
285 rendered_map_index: Annotated[str | None, Field(title="Rendered Map Index")] = None
286
287
288class TITargetStatePayload(BaseModel):
289 """
290 Schema for updating TaskInstance to a target state, excluding terminal and running states.
291 """
292
293 model_config = ConfigDict(
294 extra="forbid",
295 )
296 state: IntermediateTIState
297
298
299class TaskBreadcrumbsResponse(BaseModel):
300 """
301 Response for task breadcrumbs.
302 """
303
304 breadcrumbs: Annotated[list[dict[str, Any]], Field(title="Breadcrumbs")]
305
306
307class TaskInstanceState(str, Enum):
308 """
309 All possible states that a Task Instance can be in.
310
311 Note that None is also allowed, so always use this in a type hint with Optional.
312 """
313
314 REMOVED = "removed"
315 SCHEDULED = "scheduled"
316 QUEUED = "queued"
317 RUNNING = "running"
318 SUCCESS = "success"
319 RESTARTING = "restarting"
320 FAILED = "failed"
321 UP_FOR_RETRY = "up_for_retry"
322 UP_FOR_RESCHEDULE = "up_for_reschedule"
323 UPSTREAM_FAILED = "upstream_failed"
324 SKIPPED = "skipped"
325 DEFERRED = "deferred"
326
327
328class TaskStatesResponse(BaseModel):
329 """
330 Response for task states with run_id, task and state.
331 """
332
333 task_states: Annotated[dict[str, Any], Field(title="Task States")]
334
335
336class TerminalStateNonSuccess(str, Enum):
337 """
338 TaskInstance states that can be reported without extra information.
339 """
340
341 FAILED = "failed"
342 SKIPPED = "skipped"
343 REMOVED = "removed"
344 UPSTREAM_FAILED = "upstream_failed"
345
346
347class TriggerDAGRunPayload(BaseModel):
348 """
349 Schema for Trigger DAG Run API request.
350 """
351
352 model_config = ConfigDict(
353 extra="forbid",
354 )
355 logical_date: Annotated[AwareDatetime | None, Field(title="Logical Date")] = None
356 conf: Annotated[dict[str, Any] | None, Field(title="Conf")] = None
357 reset_dag_run: Annotated[bool | None, Field(title="Reset Dag Run")] = False
358
359
360class UpdateHITLDetailPayload(BaseModel):
361 """
362 Schema for writing the response part of a Human-in-the-loop detail for a specific task instance.
363 """
364
365 ti_id: Annotated[UUID, Field(title="Ti Id")]
366 chosen_options: Annotated[list[str], Field(min_length=1, title="Chosen Options")]
367 params_input: Annotated[dict[str, Any] | None, Field(title="Params Input")] = None
368
369
370class ValidationError(BaseModel):
371 loc: Annotated[list[str | int], Field(title="Location")]
372 msg: Annotated[str, Field(title="Message")]
373 type: Annotated[str, Field(title="Error Type")]
374
375
376class VariablePostBody(BaseModel):
377 """
378 Request body schema for creating variables.
379 """
380
381 model_config = ConfigDict(
382 extra="forbid",
383 )
384 val: Annotated[str | None, Field(title="Val")] = None
385 description: Annotated[str | None, Field(title="Description")] = None
386
387
388class VariableResponse(BaseModel):
389 """
390 Variable schema for responses with fields that are needed for Runtime.
391 """
392
393 model_config = ConfigDict(
394 extra="forbid",
395 )
396 key: Annotated[str, Field(title="Key")]
397 value: Annotated[str | None, Field(title="Value")] = None
398
399
400class XComResponse(BaseModel):
401 """
402 XCom schema for responses with fields that are needed for Runtime.
403 """
404
405 key: Annotated[str, Field(title="Key")]
406 value: JsonValue
407
408
409class XComSequenceIndexResponse(RootModel[JsonValue]):
410 root: Annotated[
411 JsonValue,
412 Field(
413 description="XCom schema with minimal structure for index-based access.",
414 title="XComSequenceIndexResponse",
415 ),
416 ]
417
418
419class XComSequenceSliceResponse(RootModel[list[JsonValue]]):
420 """
421 XCom schema with minimal structure for slice-based access.
422 """
423
424 root: Annotated[
425 list[JsonValue],
426 Field(
427 description="XCom schema with minimal structure for slice-based access.",
428 title="XComSequenceSliceResponse",
429 ),
430 ]
431
432
433class TaskInstance(BaseModel):
434 """
435 Schema for TaskInstance model with minimal required fields needed for Runtime.
436 """
437
438 id: Annotated[UUID, Field(title="Id")]
439 task_id: Annotated[str, Field(title="Task Id")]
440 dag_id: Annotated[str, Field(title="Dag Id")]
441 run_id: Annotated[str, Field(title="Run Id")]
442 try_number: Annotated[int, Field(title="Try Number")]
443 dag_version_id: Annotated[UUID, Field(title="Dag Version Id")]
444 map_index: Annotated[int | None, Field(title="Map Index")] = -1
445 hostname: Annotated[str | None, Field(title="Hostname")] = None
446 context_carrier: Annotated[dict[str, Any] | None, Field(title="Context Carrier")] = None
447
448
449class BundleInfo(BaseModel):
450 """
451 Schema for telling task which bundle to run with.
452 """
453
454 name: Annotated[str, Field(title="Name")]
455 version: Annotated[str | None, Field(title="Version")] = None
456
457
458class TerminalTIState(str, Enum):
459 SUCCESS = "success"
460 FAILED = "failed"
461 SKIPPED = "skipped"
462 UPSTREAM_FAILED = "upstream_failed"
463 REMOVED = "removed"
464
465
466class WeightRule(str, Enum):
467 DOWNSTREAM = "downstream"
468 UPSTREAM = "upstream"
469 ABSOLUTE = "absolute"
470
471
472class TriggerRule(str, Enum):
473 ALL_SUCCESS = "all_success"
474 ALL_FAILED = "all_failed"
475 ALL_DONE = "all_done"
476 ALL_DONE_MIN_ONE_SUCCESS = "all_done_min_one_success"
477 ALL_DONE_SETUP_SUCCESS = "all_done_setup_success"
478 ONE_SUCCESS = "one_success"
479 ONE_FAILED = "one_failed"
480 ONE_DONE = "one_done"
481 NONE_FAILED = "none_failed"
482 NONE_SKIPPED = "none_skipped"
483 ALWAYS = "always"
484 NONE_FAILED_MIN_ONE_SUCCESS = "none_failed_min_one_success"
485 ALL_SKIPPED = "all_skipped"
486
487
488class AssetReferenceAssetEventDagRun(BaseModel):
489 """
490 Schema for AssetModel used in AssetEventDagRunReference.
491 """
492
493 model_config = ConfigDict(
494 extra="forbid",
495 )
496 name: Annotated[str, Field(title="Name")]
497 uri: Annotated[str, Field(title="Uri")]
498 extra: Annotated[dict[str, JsonValue], Field(title="Extra")]
499
500
501class AssetResponse(BaseModel):
502 """
503 Asset schema for responses with fields that are needed for Runtime.
504 """
505
506 name: Annotated[str, Field(title="Name")]
507 uri: Annotated[str, Field(title="Uri")]
508 group: Annotated[str, Field(title="Group")]
509 extra: Annotated[dict[str, JsonValue] | None, Field(title="Extra")] = None
510
511
512class HITLDetailRequest(BaseModel):
513 """
514 Schema for the request part of a Human-in-the-loop detail for a specific task instance.
515 """
516
517 ti_id: Annotated[UUID, Field(title="Ti Id")]
518 options: Annotated[list[str], Field(min_length=1, title="Options")]
519 subject: Annotated[str, Field(title="Subject")]
520 body: Annotated[str | None, Field(title="Body")] = None
521 defaults: Annotated[list[str] | None, Field(title="Defaults")] = None
522 multiple: Annotated[bool | None, Field(title="Multiple")] = False
523 params: Annotated[dict[str, Any] | None, Field(title="Params")] = None
524 assigned_users: Annotated[list[HITLUser] | None, Field(title="Assigned Users")] = None
525
526
527class HITLDetailResponse(BaseModel):
528 """
529 Schema for the response part of a Human-in-the-loop detail for a specific task instance.
530 """
531
532 response_received: Annotated[bool, Field(title="Response Received")]
533 responded_by_user: HITLUser | None = None
534 responded_at: Annotated[AwareDatetime | None, Field(title="Responded At")] = None
535 chosen_options: Annotated[list[str] | None, Field(title="Chosen Options")] = None
536 params_input: Annotated[dict[str, Any] | None, Field(title="Params Input")] = None
537
538
539class HTTPValidationError(BaseModel):
540 detail: Annotated[list[ValidationError] | None, Field(title="Detail")] = None
541
542
543class TITerminalStatePayload(BaseModel):
544 """
545 Schema for updating TaskInstance to a terminal state except SUCCESS state.
546 """
547
548 model_config = ConfigDict(
549 extra="forbid",
550 )
551 state: TerminalStateNonSuccess
552 end_date: Annotated[AwareDatetime, Field(title="End Date")]
553 rendered_map_index: Annotated[str | None, Field(title="Rendered Map Index")] = None
554
555
556class AssetEventDagRunReference(BaseModel):
557 """
558 Schema for AssetEvent model used in DagRun.
559 """
560
561 model_config = ConfigDict(
562 extra="forbid",
563 )
564 asset: AssetReferenceAssetEventDagRun
565 extra: Annotated[dict[str, JsonValue], Field(title="Extra")]
566 source_task_id: Annotated[str | None, Field(title="Source Task Id")] = None
567 source_dag_id: Annotated[str | None, Field(title="Source Dag Id")] = None
568 source_run_id: Annotated[str | None, Field(title="Source Run Id")] = None
569 source_map_index: Annotated[int | None, Field(title="Source Map Index")] = None
570 source_aliases: Annotated[list[AssetAliasReferenceAssetEventDagRun], Field(title="Source Aliases")]
571 timestamp: Annotated[AwareDatetime, Field(title="Timestamp")]
572
573
574class AssetEventResponse(BaseModel):
575 """
576 Asset event schema with fields that are needed for Runtime.
577 """
578
579 id: Annotated[int, Field(title="Id")]
580 timestamp: Annotated[AwareDatetime, Field(title="Timestamp")]
581 extra: Annotated[dict[str, JsonValue] | None, Field(title="Extra")] = None
582 asset: AssetResponse
583 created_dagruns: Annotated[list[DagRunAssetReference], Field(title="Created Dagruns")]
584 source_task_id: Annotated[str | None, Field(title="Source Task Id")] = None
585 source_dag_id: Annotated[str | None, Field(title="Source Dag Id")] = None
586 source_run_id: Annotated[str | None, Field(title="Source Run Id")] = None
587 source_map_index: Annotated[int | None, Field(title="Source Map Index")] = None
588 partition_key: Annotated[str | None, Field(title="Partition Key")] = None
589
590
591class AssetEventsResponse(BaseModel):
592 """
593 Collection of AssetEventResponse.
594 """
595
596 asset_events: Annotated[list[AssetEventResponse], Field(title="Asset Events")]
597
598
599class DagRun(BaseModel):
600 """
601 Schema for DagRun model with minimal required fields needed for Runtime.
602 """
603
604 model_config = ConfigDict(
605 extra="forbid",
606 )
607 dag_id: Annotated[str, Field(title="Dag Id")]
608 run_id: Annotated[str, Field(title="Run Id")]
609 logical_date: Annotated[AwareDatetime | None, Field(title="Logical Date")] = None
610 data_interval_start: Annotated[AwareDatetime | None, Field(title="Data Interval Start")] = None
611 data_interval_end: Annotated[AwareDatetime | None, Field(title="Data Interval End")] = None
612 run_after: Annotated[AwareDatetime, Field(title="Run After")]
613 start_date: Annotated[AwareDatetime, Field(title="Start Date")]
614 end_date: Annotated[AwareDatetime | None, Field(title="End Date")] = None
615 clear_number: Annotated[int | None, Field(title="Clear Number")] = 0
616 run_type: DagRunType
617 state: DagRunState
618 conf: Annotated[dict[str, Any] | None, Field(title="Conf")] = None
619 triggering_user_name: Annotated[str | None, Field(title="Triggering User Name")] = None
620 consumed_asset_events: Annotated[list[AssetEventDagRunReference], Field(title="Consumed Asset Events")]
621 partition_key: Annotated[str | None, Field(title="Partition Key")] = None
622
623
624class TIRunContext(BaseModel):
625 """
626 Response schema for TaskInstance run context.
627 """
628
629 dag_run: DagRun
630 task_reschedule_count: Annotated[int | None, Field(title="Task Reschedule Count")] = 0
631 max_tries: Annotated[int, Field(title="Max Tries")]
632 variables: Annotated[list[VariableResponse] | None, Field(title="Variables")] = None
633 connections: Annotated[list[ConnectionResponse] | None, Field(title="Connections")] = None
634 upstream_map_indexes: Annotated[
635 dict[str, int | list[int] | None] | None, Field(title="Upstream Map Indexes")
636 ] = None
637 next_method: Annotated[str | None, Field(title="Next Method")] = None
638 next_kwargs: Annotated[dict[str, Any] | str | None, Field(title="Next Kwargs")] = None
639 xcom_keys_to_clear: Annotated[list[str] | None, Field(title="Xcom Keys To Clear")] = None
640 should_retry: Annotated[bool | None, Field(title="Should Retry")] = False