From 6bdb79474b72f68d57df5ec18bfdd2a43aed5979 Mon Sep 17 00:00:00 2001
From: Kaxil Naik <kaxilnaik@gmail.com>
Date: Sat, 17 May 2025 00:03:33 +0530
Subject: [PATCH] Change v1 to v2 in generated OpenAPI schema files

To remove confusion with APIv1, let's align filesnames too.
---
 .pre-commit-config.yaml                                     | 4 ++--
 .rat-excludes                                               | 2 +-
 airflow-core/docs/conf.py                                   | 4 ++--
 ...generated.yaml => v2-simple-auth-manager-generated.yaml} | 0
 .../api_fastapi/auth/managers/simple/ui/package.json        | 2 +-
 ...1-rest-api-generated.yaml => v2-rest-api-generated.yaml} | 0
 airflow-core/src/airflow/ui/openapi-merge.json              | 2 +-
 airflow-ctl/pyproject.toml                                  | 2 +-
 airflow-ctl/src/airflowctl/api/datamodels/auth_generated.py | 2 +-
 airflow-ctl/src/airflowctl/api/datamodels/generated.py      | 2 +-
 contributing-docs/16_adding_api_endpoints.rst               | 2 +-
 dev/README_RELEASE_AIRFLOW.md                               | 2 +-
 dev/README_RELEASE_PYTHON_CLIENT.md                         | 2 +-
 dev/airflow-github                                          | 2 +-
 .../airflow_breeze/commands/release_management_commands.py  | 2 +-
 dev/breeze/tests/test_selective_checks.py                   | 2 +-
 devel-common/src/docs/provider_conf.py                      | 2 +-
 ...er-generated.yaml => v2-fab-auth-manager-generated.yaml} | 0
 scripts/in_container/run_update_fastapi_api_spec.py         | 6 +++---
 19 files changed, 20 insertions(+), 20 deletions(-)
 rename airflow-core/src/airflow/api_fastapi/auth/managers/simple/openapi/{v1-simple-auth-manager-generated.yaml => v2-simple-auth-manager-generated.yaml} (100%)
 rename airflow-core/src/airflow/api_fastapi/core_api/openapi/{v1-rest-api-generated.yaml => v2-rest-api-generated.yaml} (100%)
 rename providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/openapi/{v1-fab-auth-manager-generated.yaml => v2-fab-auth-manager-generated.yaml} (100%)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 146e75f91f737..e428fa293abe1 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -133,7 +133,7 @@ repos:
           - --fuzzy-match-generates-todo
       - id: insert-license
         name: Add license for all YAML files except Helm templates
-        exclude: ^\.github/.*$|^chart/templates/.*|.*reproducible_build\.yaml$|^.*/v1.*\.yaml$|^.*/openapi/_private_ui.*\.yaml$|^.*/pnpm-lock\.yaml$
+        exclude: ^\.github/.*$|^chart/templates/.*|.*reproducible_build\.yaml$|^.*/v2.*\.yaml$|^.*/openapi/_private_ui.*\.yaml$|^.*/pnpm-lock\.yaml$
         types: [yaml]
         files: \.ya?ml$
         args:
@@ -1378,7 +1378,7 @@ repos:
         entry: >
           bash -c '
           uv run -p 3.12 --no-dev --no-progress --active --group codegen --project apache-airflow-ctl --directory airflow-ctl/ datamodel-codegen &&
-           uv run -p 3.12 --no-dev --no-progress --active --group codegen --project apache-airflow-ctl --directory airflow-ctl/ datamodel-codegen --input="../airflow-core/src/airflow/api_fastapi/auth/managers/simple/openapi/v1-simple-auth-manager-generated.yaml" --output="src/airflowctl/api/datamodels/auth_generated.py"'
+           uv run -p 3.12 --no-dev --no-progress --active --group codegen --project apache-airflow-ctl --directory airflow-ctl/ datamodel-codegen --input="../airflow-core/src/airflow/api_fastapi/auth/managers/simple/openapi/v2-simple-auth-manager-generated.yaml" --output="src/airflowctl/api/datamodels/auth_generated.py"'
         pass_filenames: false
         files: ^airflow-core/src/airflow/api_fastapi/core_api/datamodels/.*\.py$|^airflow-core/src/airflow/api_fastapi/auth/managers/simple/datamodels/.*\.py$
         require_serial: true
diff --git a/.rat-excludes b/.rat-excludes
index 96d20a27e87af..822931e135678 100644
--- a/.rat-excludes
+++ b/.rat-excludes
@@ -160,7 +160,7 @@ PKG-INFO
 # Openapi files
 .openapi-generator-ignore
 version.txt
-v1*.yaml
+v2*.yaml
 _private_ui*.yaml
 
 # Front end generated files
diff --git a/airflow-core/docs/conf.py b/airflow-core/docs/conf.py
index 6f5673f0d129f..12f4e8684a712 100644
--- a/airflow-core/docs/conf.py
+++ b/airflow-core/docs/conf.py
@@ -349,8 +349,8 @@ def add_airflow_core_exclude_patterns_to_sphinx(exclude_patterns: list[str]):
 
 graphviz_output_format = "svg"
 
-main_openapi_path = Path(main_openapi_file).parent.joinpath("v1-rest-api-generated.yaml")
-sam_openapi_path = Path(sam_openapi_file).parent.joinpath("v1-simple-auth-manager-generated.yaml")
+main_openapi_path = Path(main_openapi_file).parent.joinpath("v2-rest-api-generated.yaml")
+sam_openapi_path = Path(sam_openapi_file).parent.joinpath("v2-simple-auth-manager-generated.yaml")
 redoc = [
     {
         "name": "Simple auth manager token API",
diff --git a/airflow-core/src/airflow/api_fastapi/auth/managers/simple/openapi/v1-simple-auth-manager-generated.yaml b/airflow-core/src/airflow/api_fastapi/auth/managers/simple/openapi/v2-simple-auth-manager-generated.yaml
similarity index 100%
rename from airflow-core/src/airflow/api_fastapi/auth/managers/simple/openapi/v1-simple-auth-manager-generated.yaml
rename to airflow-core/src/airflow/api_fastapi/auth/managers/simple/openapi/v2-simple-auth-manager-generated.yaml
diff --git a/airflow-core/src/airflow/api_fastapi/auth/managers/simple/ui/package.json b/airflow-core/src/airflow/api_fastapi/auth/managers/simple/ui/package.json
index 0d0e2ba072e56..a667696be9180 100644
--- a/airflow-core/src/airflow/api_fastapi/auth/managers/simple/ui/package.json
+++ b/airflow-core/src/airflow/api_fastapi/auth/managers/simple/ui/package.json
@@ -10,7 +10,7 @@
     "lint:fix": "eslint --fix && tsc --p tsconfig.app.json",
     "format": "pnpm prettier --write .",
     "preview": "vite preview",
-    "codegen": "openapi-rq -i \"../openapi/v1-simple-auth-manager-generated.yaml\" -c axios --format prettier -o openapi-gen --operationId",
+    "codegen": "openapi-rq -i \"../openapi/v2-simple-auth-manager-generated.yaml\" -c axios --format prettier -o openapi-gen --operationId",
     "test": "vitest run",
     "coverage": "vitest run --coverage"
   },
diff --git a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-rest-api-generated.yaml b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
similarity index 100%
rename from airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-rest-api-generated.yaml
rename to airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
diff --git a/airflow-core/src/airflow/ui/openapi-merge.json b/airflow-core/src/airflow/ui/openapi-merge.json
index 7b4bcb75ca15f..059cadf6fd507 100644
--- a/airflow-core/src/airflow/ui/openapi-merge.json
+++ b/airflow-core/src/airflow/ui/openapi-merge.json
@@ -1,7 +1,7 @@
 {
   "inputs": [
     {
-      "inputFile": "../api_fastapi/core_api/openapi/v1-rest-api-generated.yaml"
+      "inputFile": "../api_fastapi/core_api/openapi/v2-rest-api-generated.yaml"
     },
     {
       "inputFile": "../api_fastapi/core_api/openapi/_private_ui.yaml"
diff --git a/airflow-ctl/pyproject.toml b/airflow-ctl/pyproject.toml
index 8eeac9ed8b301..da89517f2d9e2 100644
--- a/airflow-ctl/pyproject.toml
+++ b/airflow-ctl/pyproject.toml
@@ -137,7 +137,7 @@ use-standard-collections=true # list[] not List[]
 use-subclass-enum=true # enum, not union of Literals
 use-union-operator=true # 3.9+annotations, not `Union[]`
 
-input = "../airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-rest-api-generated.yaml"
+input = "../airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml"
 output = "src/airflowctl/api/datamodels/generated.py"
 
 ## pytest settings ##
diff --git a/airflow-ctl/src/airflowctl/api/datamodels/auth_generated.py b/airflow-ctl/src/airflowctl/api/datamodels/auth_generated.py
index c6080a010210e..5700602017d9f 100644
--- a/airflow-ctl/src/airflowctl/api/datamodels/auth_generated.py
+++ b/airflow-ctl/src/airflowctl/api/datamodels/auth_generated.py
@@ -1,5 +1,5 @@
 # generated by datamodel-codegen:
-#   filename:  v1-simple-auth-manager-generated.yaml
+#   filename:  v2-simple-auth-manager-generated.yaml
 #   version:   0.28.2
 
 from __future__ import annotations
diff --git a/airflow-ctl/src/airflowctl/api/datamodels/generated.py b/airflow-ctl/src/airflowctl/api/datamodels/generated.py
index 96bdde28b5724..abc0ae5811b89 100644
--- a/airflow-ctl/src/airflowctl/api/datamodels/generated.py
+++ b/airflow-ctl/src/airflowctl/api/datamodels/generated.py
@@ -1,5 +1,5 @@
 # generated by datamodel-codegen:
-#   filename:  v1-rest-api-generated.yaml
+#   filename:  v2-rest-api-generated.yaml
 #   version:   0.28.2
 
 from __future__ import annotations
diff --git a/contributing-docs/16_adding_api_endpoints.rst b/contributing-docs/16_adding_api_endpoints.rst
index 3713921e4a585..2c5a154991800 100644
--- a/contributing-docs/16_adding_api_endpoints.rst
+++ b/contributing-docs/16_adding_api_endpoints.rst
@@ -74,7 +74,7 @@ Step 4: Run Pre-commit Hooks
 -----------------------------
 1. Ensure all code meets the project's quality standards by running pre-commit hooks.
 2. Pre-commit hooks include static code checks, formatting, and other validations.
-3. Persisted openapi spec is located in ``v1-rest-api-generated.yaml` and a hook will take care of updating it based on your new endpoint, you just need to add and commit the change.
+3. Persisted openapi spec is located in ``v2-rest-api-generated.yaml` and a hook will take care of updating it based on your new endpoint, you just need to add and commit the change.
 4. Run the following command to execute all pre-commit hooks:
 
 .. code-block:: bash
diff --git a/dev/README_RELEASE_AIRFLOW.md b/dev/README_RELEASE_AIRFLOW.md
index 1869f790f0d56..8fbaa53b964d6 100644
--- a/dev/README_RELEASE_AIRFLOW.md
+++ b/dev/README_RELEASE_AIRFLOW.md
@@ -1061,7 +1061,7 @@ Clients can be found here:
 ### API Clients versioning policy
 
 Clients and Core versioning are completely decoupled. Clients also follow SemVer and are updated when core introduce changes relevant to the clients.
-Most of the time, if the [openapi specification](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-rest-api-generated.yaml) has
+Most of the time, if the [openapi specification](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml) has
 changed, clients need to be released.
 
 To determine if you should release API clients, you can run from the airflow repository:
diff --git a/dev/README_RELEASE_PYTHON_CLIENT.md b/dev/README_RELEASE_PYTHON_CLIENT.md
index dd8072da8f570..cc872c5517664 100644
--- a/dev/README_RELEASE_PYTHON_CLIENT.md
+++ b/dev/README_RELEASE_PYTHON_CLIENT.md
@@ -92,7 +92,7 @@ echo "${VERSION}" > clients/python/version.txt
 
 ```shell script
 cd ${AIRFLOW_REPO_ROOT}
-git log 2.8.0..HEAD --pretty=oneline -- airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-rest-api-generated.yaml
+git log 2.8.0..HEAD --pretty=oneline -- airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
 ```
 
 - Update CHANGELOG.md with the details.
diff --git a/dev/airflow-github b/dev/airflow-github
index 562c28c3fc28e..5866f13f4ffea 100755
--- a/dev/airflow-github
+++ b/dev/airflow-github
@@ -408,7 +408,7 @@ def api_clients_policy(previous_version, target_version):
         repo,
         previous_version,
         target_version,
-        files=[f"{repo.working_dir}/airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-rest-api-generated.yaml"],
+        files=[f"{repo.working_dir}/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml"],
     )
 
     clients_need_release = False
diff --git a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
index 248f0c888156f..2e23cf47d0a56 100644
--- a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
@@ -3079,7 +3079,7 @@ def split_version_and_suffix(file_name: str, suffix: str) -> VersionedFile:
 
 VERSION_FILE = PYTHON_CLIENT_DIR_PATH / "version.txt"
 SOURCE_API_YAML_PATH = (
-    AIRFLOW_ROOT_PATH / "airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-rest-api-generated.yaml"
+    AIRFLOW_ROOT_PATH / "airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml"
 )
 TARGET_API_YAML_PATH = PYTHON_CLIENT_DIR_PATH / "v1.yaml"
 OPENAPI_GENERATOR_CLI_VER = "7.13.0"
diff --git a/dev/breeze/tests/test_selective_checks.py b/dev/breeze/tests/test_selective_checks.py
index cd18e3901aa70..048324c903a97 100644
--- a/dev/breeze/tests/test_selective_checks.py
+++ b/dev/breeze/tests/test_selective_checks.py
@@ -2001,7 +2001,7 @@ def test_expected_output_push(
             id="Tests for all airflow core types except providers should run if model file changed",
         ),
         pytest.param(
-            ("airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-rest-api-generated.yaml",),
+            ("airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml",),
             {
                 "selected-providers-list-as-string": "",
                 "all-python-versions": f"['{DEFAULT_PYTHON_MAJOR_MINOR_VERSION}']",
diff --git a/devel-common/src/docs/provider_conf.py b/devel-common/src/docs/provider_conf.py
index c759564b5790d..c12457faf7314 100644
--- a/devel-common/src/docs/provider_conf.py
+++ b/devel-common/src/docs/provider_conf.py
@@ -363,7 +363,7 @@
         "v1-flask-api.yaml"
     )
     fab_auth_manager_fastapi_api_path = Path(fab_auth_manager_fastapi_api_file).parent.joinpath(
-        "v1-fab-auth-manager-generated.yaml"
+        "v2-fab-auth-manager-generated.yaml"
     )
     redoc = [
         {
diff --git a/providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/openapi/v1-fab-auth-manager-generated.yaml b/providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/openapi/v2-fab-auth-manager-generated.yaml
similarity index 100%
rename from providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/openapi/v1-fab-auth-manager-generated.yaml
rename to providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/openapi/v2-fab-auth-manager-generated.yaml
diff --git a/scripts/in_container/run_update_fastapi_api_spec.py b/scripts/in_container/run_update_fastapi_api_spec.py
index 8ef90a46e95bf..68065b84d40c4 100755
--- a/scripts/in_container/run_update_fastapi_api_spec.py
+++ b/scripts/in_container/run_update_fastapi_api_spec.py
@@ -37,15 +37,15 @@
 if TYPE_CHECKING:
     from fastapi import FastAPI
 
-OPENAPI_SPEC_FILE = Path(CORE_API_PATH).parent / "openapi" / "v1-rest-api-generated.yaml"
+OPENAPI_SPEC_FILE = Path(CORE_API_PATH).parent / "openapi" / "v2-rest-api-generated.yaml"
 # We need a "combined" spec file to generate the UI code with, but we don't want to include this in the repo
 # nor in the rendered docs, so we make this a separate file which is gitignored
 OPENAPI_UI_SPEC_FILE = Path(CORE_API_PATH).parent / "openapi" / "_private_ui.yaml"
 SIMPLE_AUTH_MANAGER_OPENAPI_SPEC_FILE = (
-    Path(SIMPLE_AUTH_MANAGER_PATH).parent / "openapi" / "v1-simple-auth-manager-generated.yaml"
+    Path(SIMPLE_AUTH_MANAGER_PATH).parent / "openapi" / "v2-simple-auth-manager-generated.yaml"
 )
 FAB_AUTH_MANAGER_OPENAPI_SPEC_FILE = (
-    Path(FAB_AUTH_MANAGER_API_PATH).parent / "openapi" / "v1-fab-auth-manager-generated.yaml"
+    Path(FAB_AUTH_MANAGER_API_PATH).parent / "openapi" / "v2-fab-auth-manager-generated.yaml"
 )
 
 
