Coverage for /home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/core_api/datamodels/ui/config.py: 81%

25 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 14:22 +0000

1# Licensed to the Apache Software Foundation (ASF) under one 

2# or more contributor license agreements. See the NOTICE file 

3# distributed with this work for additional information 

4# regarding copyright ownership. The ASF licenses this file 

5# to you under the Apache License, Version 2.0 (the 

6# "License"); you may not use this file except in compliance 

7# with the License. You may obtain a copy of the License at 

8# 

9# http://www.apache.org/licenses/LICENSE-2.0 

10# 

11# Unless required by applicable law or agreed to in writing, 

12# software distributed under the License is distributed on an 

13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 

14# KIND, either express or implied. See the License for the 

15# specific language governing permissions and limitations 

16# under the License. 

17from __future__ import annotations 

18 

19from pydantic import ConfigDict, field_serializer 

20 

21from airflow.api_fastapi.common.types import Theme, UIAlert 

22from airflow.api_fastapi.core_api.base import BaseModel 

23 

24 

25class ConfigResponse(BaseModel): 

26 """configuration serializer.""" 

27 

28 model_config = ConfigDict(json_schema_mode_override="validation") 

29 

30 fallback_page_limit: int 

31 auto_refresh_interval: int 

32 hide_paused_dags_by_default: bool 

33 instance_name: str 

34 enable_swagger_ui: bool 

35 require_confirmation_dag_change: bool 

36 default_wrap: bool 

37 test_connection: str 

38 dashboard_alert: list[UIAlert] 

39 show_external_log_redirect: bool 

40 external_log_name: str | None = None 

41 theme: Theme | None 

42 multi_team: bool 

43 rerun_with_latest_version: bool | None = None 

44 

45 @field_serializer("theme") 

46 def serialize_theme(self, theme: Theme | None) -> dict | None: 

47 if theme is None: 

48 return None 

49 return theme.model_dump(exclude_none=True)