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