Skip to content
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 @@ -23,7 +23,7 @@
from __future__ import annotations

import enum
from typing import Annotated, Any, Generic, TypeVar, Union
from typing import Annotated, Any, Generic, Literal, TypeVar, Union

from pydantic import Discriminator, Field, Tag

Expand All @@ -34,7 +34,7 @@
K = TypeVar("K")


class BulkAction(enum.Enum):
class BulkAction(str, enum.Enum):
"""Bulk Action to be performed on the used model."""

CREATE = "create"
Expand Down Expand Up @@ -66,20 +66,23 @@ class BulkBaseAction(StrictBaseModel, Generic[T]):
class BulkCreateAction(BulkBaseAction[T]):
"""Bulk Create entity serializer for request bodies."""

action: Literal[BulkAction.CREATE] = Field(description="The action to be performed on the entities.")
entities: list[T] = Field(..., description="A list of entities to be created.")
action_on_existence: BulkActionOnExistence = BulkActionOnExistence.FAIL


class BulkUpdateAction(BulkBaseAction[T]):
"""Bulk Update entity serializer for request bodies."""

action: Literal[BulkAction.UPDATE] = Field(description="The action to be performed on the entities.")
entities: list[T] = Field(..., description="A list of entities to be updated.")
action_on_non_existence: BulkActionNotOnExistence = BulkActionNotOnExistence.FAIL


class BulkDeleteAction(BulkBaseAction[T]):
"""Bulk Delete entity serializer for request bodies."""

action: Literal[BulkAction.DELETE] = Field(description="The action to be performed on the entities.")
entities: list[str] = Field(..., description="A list of entity id/key to be deleted.")
action_on_non_existence: BulkActionNotOnExistence = BulkActionNotOnExistence.FAIL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7344,14 +7344,6 @@ components:
- status
title: BaseInfoResponse
description: Base info serializer for responses.
BulkAction:
type: string
enum:
- create
- delete
- update
title: BulkAction
description: Bulk Action to be performed on the used model.
BulkActionNotOnExistence:
type: string
enum:
Expand Down Expand Up @@ -7445,7 +7437,9 @@ components:
BulkCreateAction_ConnectionBody_:
properties:
action:
$ref: '#/components/schemas/BulkAction'
type: string
const: create
title: Action
description: The action to be performed on the entities.
entities:
items:
Expand All @@ -7465,7 +7459,9 @@ components:
BulkCreateAction_PoolBody_:
properties:
action:
$ref: '#/components/schemas/BulkAction'
type: string
const: create
title: Action
description: The action to be performed on the entities.
entities:
items:
Expand All @@ -7485,7 +7481,9 @@ components:
BulkCreateAction_VariableBody_:
properties:
action:
$ref: '#/components/schemas/BulkAction'
type: string
const: create
title: Action
description: The action to be performed on the entities.
entities:
items:
Expand All @@ -7505,7 +7503,9 @@ components:
BulkDeleteAction_ConnectionBody_:
properties:
action:
$ref: '#/components/schemas/BulkAction'
type: string
const: delete
title: Action
description: The action to be performed on the entities.
entities:
items:
Expand All @@ -7525,7 +7525,9 @@ components:
BulkDeleteAction_PoolBody_:
properties:
action:
$ref: '#/components/schemas/BulkAction'
type: string
const: delete
title: Action
description: The action to be performed on the entities.
entities:
items:
Expand All @@ -7545,7 +7547,9 @@ components:
BulkDeleteAction_VariableBody_:
properties:
action:
$ref: '#/components/schemas/BulkAction'
type: string
const: delete
title: Action
description: The action to be performed on the entities.
entities:
items:
Expand Down Expand Up @@ -7598,7 +7602,9 @@ components:
BulkUpdateAction_ConnectionBody_:
properties:
action:
$ref: '#/components/schemas/BulkAction'
type: string
const: update
title: Action
description: The action to be performed on the entities.
entities:
items:
Expand All @@ -7618,7 +7624,9 @@ components:
BulkUpdateAction_PoolBody_:
properties:
action:
$ref: '#/components/schemas/BulkAction'
type: string
const: update
title: Action
description: The action to be performed on the entities.
entities:
items:
Expand All @@ -7638,7 +7646,9 @@ components:
BulkUpdateAction_VariableBody_:
properties:
action:
$ref: '#/components/schemas/BulkAction'
type: string
const: update
title: Action
description: The action to be performed on the entities.
entities:
items:
Expand Down
43 changes: 27 additions & 16 deletions airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,13 +536,6 @@ export const $BaseInfoResponse = {
description: "Base info serializer for responses.",
} as const;

export const $BulkAction = {
type: "string",
enum: ["create", "delete", "update"],
title: "BulkAction",
description: "Bulk Action to be performed on the used model.",
} as const;

export const $BulkActionNotOnExistence = {
type: "string",
enum: ["fail", "skip"],
Expand Down Expand Up @@ -670,7 +663,9 @@ export const $BulkBody_VariableBody_ = {
export const $BulkCreateAction_ConnectionBody_ = {
properties: {
action: {
$ref: "#/components/schemas/BulkAction",
type: "string",
const: "create",
title: "Action",
description: "The action to be performed on the entities.",
},
entities: {
Expand All @@ -695,7 +690,9 @@ export const $BulkCreateAction_ConnectionBody_ = {
export const $BulkCreateAction_PoolBody_ = {
properties: {
action: {
$ref: "#/components/schemas/BulkAction",
type: "string",
const: "create",
title: "Action",
description: "The action to be performed on the entities.",
},
entities: {
Expand All @@ -720,7 +717,9 @@ export const $BulkCreateAction_PoolBody_ = {
export const $BulkCreateAction_VariableBody_ = {
properties: {
action: {
$ref: "#/components/schemas/BulkAction",
type: "string",
const: "create",
title: "Action",
description: "The action to be performed on the entities.",
},
entities: {
Expand All @@ -745,7 +744,9 @@ export const $BulkCreateAction_VariableBody_ = {
export const $BulkDeleteAction_ConnectionBody_ = {
properties: {
action: {
$ref: "#/components/schemas/BulkAction",
type: "string",
const: "delete",
title: "Action",
description: "The action to be performed on the entities.",
},
entities: {
Expand All @@ -770,7 +771,9 @@ export const $BulkDeleteAction_ConnectionBody_ = {
export const $BulkDeleteAction_PoolBody_ = {
properties: {
action: {
$ref: "#/components/schemas/BulkAction",
type: "string",
const: "delete",
title: "Action",
description: "The action to be performed on the entities.",
},
entities: {
Expand All @@ -795,7 +798,9 @@ export const $BulkDeleteAction_PoolBody_ = {
export const $BulkDeleteAction_VariableBody_ = {
properties: {
action: {
$ref: "#/components/schemas/BulkAction",
type: "string",
const: "delete",
title: "Action",
description: "The action to be performed on the entities.",
},
entities: {
Expand Down Expand Up @@ -865,7 +870,9 @@ Fields are populated in the response only if the respective action was part of t
export const $BulkUpdateAction_ConnectionBody_ = {
properties: {
action: {
$ref: "#/components/schemas/BulkAction",
type: "string",
const: "update",
title: "Action",
description: "The action to be performed on the entities.",
},
entities: {
Expand All @@ -890,7 +897,9 @@ export const $BulkUpdateAction_ConnectionBody_ = {
export const $BulkUpdateAction_PoolBody_ = {
properties: {
action: {
$ref: "#/components/schemas/BulkAction",
type: "string",
const: "update",
title: "Action",
description: "The action to be performed on the entities.",
},
entities: {
Expand All @@ -915,7 +924,9 @@ export const $BulkUpdateAction_PoolBody_ = {
export const $BulkUpdateAction_VariableBody_ = {
properties: {
action: {
$ref: "#/components/schemas/BulkAction",
type: "string",
const: "update",
title: "Action",
description: "The action to be performed on the entities.",
},
entities: {
Expand Down
23 changes: 9 additions & 14 deletions airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@ export type BaseInfoResponse = {
status: string | null;
};

/**
* Bulk Action to be performed on the used model.
*/
export type BulkAction = "create" | "delete" | "update";

/**
* Bulk Action to be taken if the entity does not exist.
*/
Expand Down Expand Up @@ -198,7 +193,7 @@ export type BulkCreateAction_ConnectionBody_ = {
/**
* The action to be performed on the entities.
*/
action: BulkAction;
action: "create";
/**
* A list of entities to be created.
*/
Expand All @@ -210,7 +205,7 @@ export type BulkCreateAction_PoolBody_ = {
/**
* The action to be performed on the entities.
*/
action: BulkAction;
action: "create";
/**
* A list of entities to be created.
*/
Expand All @@ -222,7 +217,7 @@ export type BulkCreateAction_VariableBody_ = {
/**
* The action to be performed on the entities.
*/
action: BulkAction;
action: "create";
/**
* A list of entities to be created.
*/
Expand All @@ -234,7 +229,7 @@ export type BulkDeleteAction_ConnectionBody_ = {
/**
* The action to be performed on the entities.
*/
action: BulkAction;
action: "delete";
/**
* A list of entity id/key to be deleted.
*/
Expand All @@ -246,7 +241,7 @@ export type BulkDeleteAction_PoolBody_ = {
/**
* The action to be performed on the entities.
*/
action: BulkAction;
action: "delete";
/**
* A list of entity id/key to be deleted.
*/
Expand All @@ -258,7 +253,7 @@ export type BulkDeleteAction_VariableBody_ = {
/**
* The action to be performed on the entities.
*/
action: BulkAction;
action: "delete";
/**
* A list of entity id/key to be deleted.
*/
Expand Down Expand Up @@ -292,7 +287,7 @@ export type BulkUpdateAction_ConnectionBody_ = {
/**
* The action to be performed on the entities.
*/
action: BulkAction;
action: "update";
/**
* A list of entities to be updated.
*/
Expand All @@ -304,7 +299,7 @@ export type BulkUpdateAction_PoolBody_ = {
/**
* The action to be performed on the entities.
*/
action: BulkAction;
action: "update";
/**
* A list of entities to be updated.
*/
Expand All @@ -316,7 +311,7 @@ export type BulkUpdateAction_VariableBody_ = {
/**
* The action to be performed on the entities.
*/
action: BulkAction;
action: "update";
/**
* A list of entities to be updated.
*/
Expand Down
Loading