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